*{box-sizing:border-box}body{margin:0;font:13px/1.45 Inter,system-ui,-apple-system,Segoe UI,Roboto,sans-serif;color:#1f2933;background:#f5f6f8}
header{background:#7a1f2b;color:#fff;padding:14px 22px;display:flex;align-items:baseline;gap:14px;flex-wrap:wrap}header h1{font-size:18px;margin:0;font-weight:650}header span{opacity:.8;font-size:12px}
#tabs{display:flex;gap:2px;background:#fff;border-bottom:1px solid #e3e5e8;padding:0 16px;overflow-x:auto}#tabs a{padding:11px 14px;color:#52606d;text-decoration:none;white-space:nowrap;border-bottom:2px solid transparent}#tabs a.on{color:#7a1f2b;border-color:#7a1f2b;font-weight:600}
main{padding:14px 16px;max-width:none;width:100%;box-sizing:border-box}section{background:#fff;border:1px solid #e3e5e8;border-radius:10px;padding:14px 16px;margin-bottom:14px}h3{margin:0 0 6px;font-size:14.5px}h4{margin:8px 0 4px}
.grid4{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin-bottom:12px}.kpi{background:#fff;border:1px solid #e3e5e8;border-radius:10px;padding:12px 14px}.kl{color:#616e7c;font-size:12px}.kv{font-size:24px;font-weight:650;margin:2px 0}.ks{color:#7b8794;font-size:11.5px}.kpi.bad .kv{color:#b42318}.kpi.warn .kv{color:#b54708}
.two{display:grid;grid-template-columns:1fr 1fr;gap:14px}.two>section{margin:0}@media(max-width:900px){.two,.grid4{grid-template-columns:1fr 1fr}}
table{border-collapse:collapse;width:100%}th,td{padding:6px 8px;border-bottom:1px solid #eef0f2;text-align:left;vertical-align:top}th{background:#f8f9fa;font-weight:600;color:#3e4c59;font-size:12px;position:sticky;top:0;z-index:1}
.r{text-align:right}.b{font-weight:650}.mut{color:#7b8794}.sm{font-size:11px}.red{color:#b42318;font-weight:650}.amb{color:#b54708;font-weight:600}
.scroll{overflow:auto;max-height:72vh;border:1px solid #e3e5e8;border-radius:8px;background:#fff}.mat td,.mat th{text-align:center;padding:4px 6px;font-size:12px;border-right:1px solid #f1f2f4}.mat .sticky{position:sticky;left:0;background:#fff;text-align:left;min-width:220px;z-index:2}.mat th.sticky{z-index:3;background:#f8f9fa}
.z{color:#cbd2d9}.hub{background:#eef4ff}.up{background:#e3f6e8;color:#14532d;font-weight:600}.dn{background:#fff4d6;color:#7a4b00;font-weight:600}.riskc{background:#fde4e1;color:#9b1c1c;font-weight:650}.g{font-size:10px;color:#7a1f2b}
button{font:inherit;border:1px solid #cbd2d9;background:#fff;border-radius:7px;padding:6px 11px;cursor:pointer}button:hover{background:#f5f6f8}button.pri{background:#7a1f2b;color:#fff;border-color:#7a1f2b}button.x{border:none;color:#b42318;padding:2px 6px}.chip.on{background:#7a1f2b;color:#fff;border-color:#7a1f2b}
.row{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin:8px 0}.sp{flex:1}tr.off td{opacity:.45;text-decoration:line-through}tr.add td{background:#fafbfc}
.tag{font-size:11px;padding:2px 7px;border-radius:10px;white-space:nowrap}.t0{background:#e0ecff;color:#1849a9}.t1{background:#f3e8ff;color:#6b21a8}.t2{background:#e3f6e8;color:#14532d}
input,select,textarea{font:inherit;border:1px solid #cbd2d9;border-radius:6px;padding:5px 7px;max-width:100%}textarea{width:100%}
.form label{display:flex;justify-content:space-between;gap:10px;align-items:center;padding:6px 0;border-bottom:1px dashed #eef0f2}.form input[type=number],.form select{width:220px}.ordrow{padding:3px 0}.ordrow button{padding:1px 7px;margin-left:4px}
.flow{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:8px 0 12px}.flow div{border:1px solid #e3e5e8;border-radius:9px;padding:9px 12px;background:#fbf7f7;font-weight:600}.flow span{font-weight:400;color:#616e7c;font-size:11.5px}.flow b{color:#7a1f2b}code{background:#f1f2f4;padding:1px 4px;border-radius:4px}.alert{background:#fff7e6;border-color:#f5c26b}.warnt{background:#fff4d6;color:#7a4b00}.login{max-width:360px;margin:12vh auto;background:#fff;border:1px solid #e3e5e8;border-radius:12px;padding:24px}.login h2{margin:0 0 4px;color:#7a1f2b}.login input{width:100%;margin:6px 0 10px;padding:9px}.login button{width:100%;padding:10px}
header .who{margin-left:auto;font-size:12px}header .who button{background:transparent;color:#fff;border-color:#ffffff66;padding:3px 9px;margin-left:8px}
.toast{position:fixed;bottom:18px;right:18px;background:#1f2933;color:#fff;padding:10px 14px;border-radius:8px;z-index:99;max-width:420px}.toast.err{background:#b42318}
.st{font-size:11px;padding:2px 8px;border-radius:10px;background:#eef0f2}.st.draft{background:#eef0f2}.st.submitted{background:#fff4d6;color:#7a4b00}.st.approved{background:#e3f6e8;color:#14532d}.st.exported{background:#e0ecff;color:#1849a9}
.card{border:1px solid #e3e5e8;border-radius:9px;padding:10px 12px;margin-bottom:8px;background:#fff}.card .h{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.mat th.colh{min-width:92px;vertical-align:bottom;white-space:normal}.mat .cc{font-weight:700;font-size:11px;color:#1f2933}.mat .cn{font-weight:400;font-size:10.5px;color:#52606d;line-height:1.25}.mat th.rowh{min-width:260px;text-align:left}.mat td.sticky .b{font-size:11.5px}.drop{border:2px dashed #d6b8bd;background:#fdf8f8}details summary{cursor:pointer;margin-top:6px}.dropzone{border:2px dashed #c9a2a8;background:#fdf8f8;border-radius:10px;padding:26px;text-align:center;cursor:pointer;outline:none}.dropzone:hover,.dropzone:focus,.dropzone.over{background:#f8ecee;border-color:#8b1e2d}.dz-ic{font-size:26px;color:#8b1e2d}.dropzone:focus{box-shadow:0 0 0 3px #8b1e2d33}.dropzone.act{border-color:#8b1e2d;background:#f8ecee}.card{border:1px solid #e3e5e8;border-radius:8px;padding:10px;background:#fff}details.whb{border:1px solid #e3e5e8;border-radius:8px;margin:8px 0;background:#fff}details.whb>summary{padding:8px 10px;cursor:pointer;background:#faf7f7;border-radius:8px}details.whb[open]>summary{border-bottom:1px solid #eee}
tr.okrow td{background:#f0faf2}tr.sel td{background:#fdf3f4}.tag.t0{background:#e8eefc}.tag.t2{background:#e3f2e1}
table.grid th,table.grid td{white-space:nowrap}table.grid td.pair,table.grid th.pair{background:#f7f9fc}table.grid tr.flt th{background:#fff;padding:2px}table.grid tr.flt input{width:100%;min-width:60px;font-size:12px;padding:2px 4px}
table.grid thead{position:sticky;top:0;z-index:2}table.grid thead tr:first-child th{background:#8b1e2d;color:#fff}.grpTog .chip{display:inline-flex;gap:4px;align-items:center}.chip.dis{opacity:.45}
table.grid td.man{background:#fff4d6!important;font-weight:600}table.grid tr.dirty td{background:#fff8e6}table.grid select.aW{font-size:12px;max-width:120px}

table.grid th.wh{min-width:64px;white-space:normal;font-size:11px;line-height:1.2;text-align:center}table.grid td.wh{text-align:right}table.grid td.wh.own{background:#eef7ee}table.grid td.wh input{width:48px;text-align:right}table.grid th.wh .wc{display:block;font-weight:700}

.mat td.negc{background:#fde2e1;color:#b91c1c;font-weight:700}.kpi.neg .kv{color:#b91c1c}
.tst{display:inline-block;padding:2px 7px;border-radius:10px;font-weight:600;white-space:nowrap}
.tst.dr{background:#eee;color:#666}.tst.mk{background:#fff4d6;color:#8a5a00}.tst.go{background:#ffe4cc;color:#a04800}.tst.ok{background:#c8ecc8;color:#1d6b1d}
a.btn{display:inline-block;padding:7px 14px;border-radius:8px;text-decoration:none;font-weight:600;cursor:grab;border:1px solid #8b1e2d;background:#8b1e2d;color:#fff}
a.btn:active{cursor:grabbing}
details.stratBox{border:1px solid #e3e5e8;border-radius:8px;padding:6px 10px;margin:8px 0;background:#fcfbfb}details.stratBox table{margin-top:6px}
tr.grpr td{background:#f3e8ea;color:#8b1e2d;font-weight:700;font-size:12px;padding:3px 8px}
/* lưới phân bổ: cột Nhóm / Nguồn / Mã hàng gọn hơn */
table.grid td:nth-child(3),table.grid td:nth-child(4){white-space:normal;font-size:11px;line-height:1.2;max-width:70px}
table.grid td:nth-child(6){white-space:normal;max-width:160px;line-height:1.25}table.grid td:nth-child(6) b{font-size:11.5px}
table.grid tr.grpr td{white-space:nowrap}
/* chế độ co vừa màn hình */
table.grid.fit{table-layout:fixed;width:100%;font-size:11px}
table.grid.fit th,table.grid.fit td{white-space:normal;overflow:hidden;text-overflow:ellipsis;padding:3px 3px;word-break:break-word;line-height:1.2}
table.grid.fit th.wh{min-width:0;font-size:9.5px}table.grid.fit th.wh .wc{font-size:10px}
table.grid.fit td.wh input,table.grid.fit input.pIn{width:100%!important;min-width:0;padding:1px 2px;font-size:11px;-moz-appearance:textfield}
table.grid.fit input::-webkit-inner-spin-button,table.grid.fit input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
table.grid.fit tr.flt input{min-width:0;font-size:10px;padding:1px 2px}
table.grid.fit td:nth-child(6){max-width:none}table.grid.fit td:nth-child(6) .sm,table.grid.fit td .sm{font-size:10px}
table.grid.fit tr.grpr td{white-space:nowrap}
.desc{font-size:11px;color:#7c2d12;background:#fff7ed;border-radius:4px;padding:1px 4px;margin-top:2px;white-space:normal;line-height:1.25}

dialog.chooser{max-width:560px;border:1px solid #ccc;border-radius:10px;padding:18px;box-shadow:0 8px 30px rgba(0,0,0,.25)}dialog.chooser::backdrop{background:rgba(0,0,0,.35)}dialog.chooser h3{margin:0 0 8px}button.danger{background:#c62828;color:#fff;border-color:#c62828}

details.ms{position:relative;display:inline-block}details.ms>summary{list-style:none;cursor:pointer;border:1px solid #c9ccd1;border-radius:6px;padding:4px 8px;background:#fff;white-space:nowrap}details.ms>summary::-webkit-details-marker{display:none}details.ms[open]>summary{border-color:#1a73e8}.msp{position:absolute;z-index:60;top:100%;left:0;margin-top:4px;background:#fff;border:1px solid #c9ccd1;border-radius:8px;box-shadow:0 6px 20px rgba(0,0,0,.15);padding:8px 10px;max-height:340px;overflow:auto;min-width:230px}.msp label{display:block;white-space:nowrap;padding:2px 0;cursor:pointer}
tr.warn td{background:#fff6d6}

nav.subtabs{display:flex;gap:6px;flex-wrap:wrap;margin:0 0 10px}nav.subtabs a{padding:6px 12px;border:1px solid #d5d9de;border-radius:16px;background:#fff;color:#52606d;text-decoration:none;font-size:13px}nav.subtabs a.on{background:#7a1f2b;border-color:#7a1f2b;color:#fff;font-weight:600}
dialog.chooser.wide{max-width:1000px;width:95vw}
td.wrap,.wrap{white-space:normal!important;word-break:break-word}
table.sub{width:100%;background:#fafbfc}table.sub td{vertical-align:top}
a.shipLink{color:#1849a9}

table.mat td.over{background:#ede9fe;color:#5b21b6}
