/* TD-121 (8.6.0): màn điều hành sản xuất, sổ nhận BTP trên điện thoại (quyết định 18, 22). Chỉ áp trong lớp .dh – không đổi kiểu chung.
   Dùng bảng màu chung của Minh Anh Office (--brand, --ok, --warn, --bad, --surface, --line … khai ở index.html). Số chính to, vùng chạm ≥ 48 px,
   thanh điều hướng dưới dính đáy, tự co giãn 360 px – máy tính bảng – xoay ngang. */
.dh { --dh-ok: var(--ok, #1B6B45); --dh-ok-s: var(--ok-soft, #E3F3EA); --dh-warn: var(--warn, #7A4D00); --dh-warn-s: var(--warn-soft, #FFF1D1); --dh-warn-c: #E0A100;
  --dh-bad: var(--bad, #A1261A); --dh-bad-s: var(--bad-soft, #FCE8E6); --dh-info: var(--info, #1F5A85); --dh-info-s: var(--info-soft, #E6EFF7);
  max-width: 760px; margin: 0 auto; padding: 0 12px; display: flex; flex-direction: column; gap: 10px; font-variant-numeric: tabular-nums; }
.dh .m-ok { color: var(--dh-ok); } .dh .m-vang { color: var(--dh-warn); } .dh .m-do { color: var(--dh-bad); } .dh .m-xam { color: var(--muted); } .dh .m-xanh { color: var(--dh-info); }

/* Đầu màn */
.dh-top { position: sticky; top: 0; z-index: 5; background: var(--surface); margin: 0 -12px; padding: 10px 14px 8px; border-bottom: 1px solid var(--line); }
.dh-top .r1 { display: flex; align-items: center; gap: 8px; }
.dh-top h1 { flex: 1; margin: 0; font-size: 18px; line-height: 1.3; font-weight: 700; }
.dh-top .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.dh-lui { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; margin-left: -10px; color: var(--muted); border-radius: 10px; }
.dh-lui:active { background: var(--soft); }
.dh-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line3, #CFCCC5);
  background: var(--surface); color: var(--fg); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; cursor: pointer; }
.dh-btn.pri { background: var(--brand); border-color: var(--brand); color: #fff; }
.dh-btn.pri:hover { color: #fff; background: var(--brand-h, #963F05); }
.dh-btn.lon { width: 100%; min-height: 52px; border-radius: 12px; font-size: 16px; margin-top: 4px; }
.dh-btn:disabled { opacity: .6; }
.dh-ngoai { display: flex; gap: 8px; align-items: center; background: var(--dh-warn-s); color: var(--dh-warn); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; font-weight: 600; }
.dh-keo { height: 0; overflow: hidden; text-align: center; font-size: 13px; color: var(--muted); transition: height .15s; }
.dh-keo.on { height: 28px; line-height: 28px; }

/* Thẻ */
.dh-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.dh-card > h3 { margin: 0 0 8px; font-size: 12.5px; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dh-card > h3 .r { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--fg); font-size: 13px; }
.dh-rong { margin: 4px 0; color: var(--muted); font-size: 14px; }
.dh-ghi { display: block; color: var(--muted); font-size: 12.5px; margin-top: 8px; }
.dh-ma { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.dh-ma b { font-size: 18px; } .dh-ma span { font-size: 12.5px; color: var(--muted); }
.dh-big { display: flex; align-items: baseline; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.dh-big .n { font-size: 36px; font-weight: 800; line-height: 1.05; }
.dh-big .of { color: var(--muted); font-size: 14px; }
.dh-bar { position: relative; height: 8px; background: var(--line2, #EFEDE9); border-radius: 6px; overflow: hidden; margin-top: 8px; }
.dh-bar i { display: block; height: 100%; border-radius: 6px; background: var(--muted); }
.dh-bar i.m-ok { background: var(--dh-ok); } .dh-bar i.m-vang { background: var(--dh-warn-c); } .dh-bar i.m-do { background: var(--dh-bad); } .dh-bar i.m-xam { background: #A9A6A0; }
.dh-bar b { position: absolute; top: -2px; width: 2px; height: 12px; background: var(--fg); }
.dh-hang { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.dh-tag { display: inline-flex; align-items: center; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.dh-tag.m-ok { background: var(--dh-ok-s); color: var(--dh-ok); } .dh-tag.m-vang { background: var(--dh-warn-s); color: var(--dh-warn); } .dh-tag.m-do { background: var(--dh-bad-s); color: var(--dh-bad); }
.dh-tag.m-cam { background: #FDEEDF; color: #A34A05; } .dh .m-cam { color: #A34A05; }   /* TD-141: Thừa BTP màu cam */
.dh-dem { min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; background: var(--soft); color: var(--muted); font-size: 12.5px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.dh-dem.co { background: var(--dh-bad); color: #fff; }

/* Ô chỉ số */
.dh-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dh-grid.g3 { grid-template-columns: repeat(3, 1fr); }
.dh-kpi { display: flex; flex-direction: column; gap: 2px; min-height: 84px; border-radius: 12px; padding: 10px 12px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); text-decoration: none; }
.dh-kpi .l { font-size: 12px; color: var(--muted); line-height: 1.3; }
.dh-kpi .v { font-size: 26px; font-weight: 800; line-height: 1.15; }
.dh-kpi .p { font-size: 12px; color: var(--muted); line-height: 1.3; }
.dh-kpi.m-ok { background: var(--dh-ok-s); border-color: #bfe2cd; } .dh-kpi.m-ok .v { color: var(--dh-ok); }
.dh-kpi.m-vang { background: var(--dh-warn-s); border-color: #f3dca5; } .dh-kpi.m-vang .v { color: var(--dh-warn); }
.dh-kpi.m-do { background: var(--dh-bad-s); border-color: #f2c7c2; } .dh-kpi.m-do .v { color: var(--dh-bad); }
.dh-kpi.m-xam { color: var(--fg); }
.dh-grid.g3 .dh-kpi .v { font-size: 22px; }
.dh-ba { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; gap: 4px; }
.dh-ba b { display: block; font-size: 21px; font-weight: 800; } .dh-ba span { font-size: 12px; color: var(--muted); }
.dh-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 14px; padding: 8px 0; border-top: 1px solid var(--line2, #EFEDE9); flex-wrap: wrap; }
.dh-card > .dh-row:first-of-type, .dh-card > h3 + .dh-row { border-top: 0; }
.dh-row > span { color: var(--muted); flex: 1 1 50%; } .dh-row > b { text-align: right; }
.dh-row.sub { padding-top: 0; border-top: 0; font-size: 12.5px; }
.dh-row .dh-bar { flex-basis: 100%; margin-top: 2px; }
.dh-more { display: flex; justify-content: space-between; align-items: center; min-height: 44px; margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--line2, #EFEDE9); font-weight: 600; text-decoration: none; }

/* Cần xử lý */
.dh-lvl { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 6px 0; margin-top: 4px; border: 0; background: none; font-size: 13px; font-weight: 800; text-align: left; cursor: pointer; }
.dh-lvl .dot, .dh-li > .dot { flex: 0 0 10px; height: 10px; border-radius: 50%; background: currentColor; }
.dh-lvl.m-do { color: var(--dh-bad); } .dh-lvl.m-vang { color: var(--dh-warn); } .dh-lvl.m-xanh { color: var(--dh-info); }
.dh-mo { margin-left: auto; color: var(--muted); font-size: 18px; }
.dh-ls { list-style: none; margin: 0; padding: 0; }
.dh-li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line2, #EFEDE9); }
.dh-li:first-child { border-top: 0; }
.dh-li > .dot { margin-top: 6px; }
.dh-li > .dot.m-do { color: var(--dh-bad); } .dh-li > .dot.m-vang { color: var(--dh-warn-c); } .dh-li > .dot.m-xanh { color: var(--dh-info); }
.dh-li-t { flex: 1; min-width: 0; color: var(--fg); text-decoration: none; font-size: 14px; line-height: 1.4; }
.dh-li-t b { font-weight: 600; } .dh-li-t small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.dh-li-t small.dh-da { color: var(--dh-ok); }
.dh-li.xong .dh-li-t b { color: var(--muted); }
.dh-li-n { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.dh-nut { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 64px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line3, #CFCCC5);
  background: var(--surface); color: var(--fg); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; cursor: pointer; }
.dh-nut.pri { background: var(--brand); border-color: var(--brand); color: #fff; }
.dh-nut.nhe { color: var(--muted); }

/* Danh sách tổ, xưởng, mã */
.dh-tos { display: flex; flex-direction: column; }
.dh-to { display: block; padding: 10px 0; border-top: 1px solid var(--line2, #EFEDE9); color: var(--fg); text-decoration: none; min-height: 48px; }
.dh-tos > .dh-to:first-child { border-top: 0; padding-top: 2px; }
.dh-to .t { display: flex; align-items: baseline; gap: 8px; }
.dh-to .t b { font-size: 15px; } .dh-to .ms { flex: 1; font-size: 12.5px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dh-to .pct { font-weight: 800; font-size: 15px; }
.dh-to .tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 7px; align-items: center; }
.dh-mh { padding: 10px 0; border-top: 1px solid var(--line2, #EFEDE9); font-size: 14px; }
.dh-mas > .dh-mh:first-child { border-top: 0; padding-top: 2px; }
.dh-mh .t { display: flex; justify-content: space-between; gap: 8px; } .dh-mh .pct { font-weight: 800; }
.dh-mh .s { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.dh-ngay { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.dh-ngay input { min-height: 44px; border: 1px solid var(--line3, #CFCCC5); border-radius: 10px; padding: 0 10px; background: var(--surface); }
.dh-cot small { display: block; color: var(--muted); font-size: 12.5px; margin: 8px 0 4px; }
.dh-cot .cs { display: flex; align-items: flex-end; gap: 6px; height: 96px; }
.dh-cot .c { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; }
.dh-cot .c i { display: block; width: 70%; max-width: 34px; min-height: 2px; border-radius: 5px 5px 0 0; background: var(--brand); }
.dh-cot .c i.m-ok { background: var(--dh-ok); } .dh-cot .c i.m-do { background: var(--dh-bad); } .dh-cot .c i.m-xam { background: var(--brand); }
.dh-cot .c em { font-style: normal; font-size: 11px; color: var(--muted); } .dh-cot .c span { font-size: 11px; color: var(--muted); margin-top: 3px; }
.dh-tv { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 0; border-top: 1px solid var(--line2, #EFEDE9); }
.dh-card > h3 + .dh-tv { border-top: 0; }
.dh-tv .grow { flex: 1; min-width: 0; } .dh-tv small { display: block; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dh-tim { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line3, #CFCCC5); border-radius: 12px; padding: 0 12px; color: var(--muted); }
.dh-tim input { flex: 1; border: 0; min-height: 46px; background: none; outline: none; font-size: 15px; color: var(--fg); }

/* Chip lọc nhanh, thẻ chuyển vai */
.dh-chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0; scrollbar-width: none; }
.dh-chips::-webkit-scrollbar { display: none; }
.dh-chips .chip { flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--fg); font-size: 13.5px; font-weight: 600; text-decoration: none; cursor: pointer; }
.dh-chips .chip.on { background: var(--brand-soft); border-color: #f1c79c; color: var(--brand-ink); }
.dh-chips.sm .chip { min-height: 44px; padding: 0 10px; font-size: 12.5px; text-transform: none; letter-spacing: 0; }

/* Thanh điều hướng dưới (một tay, vùng ngón cái) */
.dh-nav { position: sticky; bottom: 0; z-index: 6; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; margin: 6px -12px 0; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px); box-shadow: 0 -4px 14px rgba(0, 0, 0, .05); }
.dh-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; color: var(--muted); font-size: 11.5px; text-decoration: none; font-weight: 600; }
.dh-nav a.on { color: var(--brand); }
/* Đợt 4 (G2): dưới 900 px thanh .bnav của app (position fixed, cao 64 px + vùng an toàn, z-index 25) và .netbar che .dh-nav – đặt .dh-nav ngay trên chúng;
   trang không có .bnav (hoặc .bnav rỗng) thì về đáy màn hình */
@media (max-width: 899px) {
  .dh-nav { bottom: calc(64px + env(safe-area-inset-bottom, 0px)); padding-bottom: 0; }
  body:not(:has(nav.bnav > *)) .dh-nav { bottom: 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  body.has-nb .dh-nav, body:has(.netbar:not(:empty)) .dh-nav { bottom: calc(122px + env(safe-area-inset-bottom, 0px)); }   /* thanh trạng thái / gợi ý cài app (.netbar) nằm trên .bnav – như sx.css */
}

/* Sổ nhận BTP */
.dh-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--soft); border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 10px; }
.dh-seg button { min-height: 44px; border: 0; border-radius: 9px; background: none; font-weight: 700; color: var(--muted); cursor: pointer; }
.dh-seg button.on { background: var(--surface); color: var(--brand-ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.dh-f { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.dh-f > span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.dh-f input, .dh-f select { min-height: 48px; border: 1px solid var(--line3, #CFCCC5); border-radius: 10px; padding: 0 12px; font-size: 16px; background: var(--surface); }
.dh-f input.dh-num, input.dh-num { font-size: 32px; font-weight: 800; text-align: center; min-height: 64px; letter-spacing: .02em; }
.dh-bao { background: var(--dh-info-s); color: var(--dh-info); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; }
.dh-ls.his .dh-li-t b { font-weight: 700; }

/* Co giãn: điện thoại nhỏ, máy tính bảng, xoay ngang */
@media (max-width: 370px) {
  .dh-grid.g3 { grid-template-columns: 1fr 1fr; }
  .dh-grid.g3 .dh-kpi:first-child { grid-column: 1 / -1; }
  .dh-big .n { font-size: 32px; }
  .dh-nav a { font-size: 10.5px; }
}
@media (min-width: 700px) {
  .dh { padding: 0 20px; gap: 12px; }
  .dh-top { margin: 0 -20px; padding: 12px 20px 10px; }
  .dh-nav { margin: 6px -20px 0; }
  .dh-grid { grid-template-columns: repeat(4, 1fr); }
  .dh-grid.g3 { grid-template-columns: repeat(3, 1fr); }
  .dh-kpi .v { font-size: 30px; }
}
@media (orientation: landscape) and (max-height: 500px) { .dh-top { position: static; } .dh-nav a { min-height: 48px; } }
@media (prefers-reduced-motion: reduce) { .dh-keo { transition: none; } }

/* TD-119 + TD-121 đợt 2 (public/js/sx-btp.js): dòng nhập nhiều dòng, đợt Cắt, thẻ Tiến độ, nhu cầu */
.bt-dongs { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.bt-dong { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.bt-dong input, .bt-dong select { flex: 1 1 60px; min-width: 0; min-height: 44px; border: 1px solid var(--line3, #CFCCC5); border-radius: 10px; padding: 0 10px; font-size: 15px; background: var(--surface); }
.bt-dong input[inputmode="numeric"] { flex: 0 1 92px; font-weight: 800; text-align: right; font-size: 17px; }
.bt-dong .dh-f { flex: 1 1 140px; margin: 0; }
.bt-dong.xn { padding: 6px 0; border-top: 1px solid var(--line2, #EFEDE9); }
.bt-mo { flex: 1 1 100%; font-weight: 600; font-size: 14px; }
.bt-mo small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; }
.bt-dot, .bt-nc { padding: 10px 0; border-top: 1px solid var(--line2, #EFEDE9); }
.dh-card > h3 + .bt-dot, .dh-card > h3 + .bt-nc { border-top: 0; padding-top: 2px; }
.bt-ck { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; }
.bt-ck input { width: 22px; height: 22px; }
.bt-td { display: flex; flex-direction: column; }
.bt-td-r { display: grid; grid-template-columns: 1fr 74px 84px; align-items: center; gap: 8px; min-height: 52px; border-top: 1px solid var(--line2, #EFEDE9); }
.bt-td-r:first-child { border-top: 0; }
.bt-td-r .t { font-weight: 600; font-size: 15px; } .bt-td-r .t small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.bt-td-r b { text-align: right; font-size: 20px; font-weight: 800; } .bt-td-r b.lk { color: var(--muted); font-size: 17px; }
.bt-td-r.sau .t { color: var(--muted); } .bt-td-r .sau { grid-column: 2 / 4; text-align: right; color: var(--muted); font-size: 13px; font-style: italic; }
/* TD-122 (8.6.0): nút Báo sự vụ / Giao xử lý / Xem SV trên dòng cảnh báo; mã SV, trạng thái, người giữ việc dưới câu cảnh báo */
.dh-nut.sv { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; min-height: 44px; }
.dh-li-t small.dh-sv { color: var(--brand); font-weight: 600; }
.dh-li-t small.dh-sv.xong { color: var(--muted); font-weight: 400; }
.dh-nn .dh-bar { flex-basis: 100%; }
.dh-grid.g2 { grid-template-columns: repeat(2, 1fr); }   /* TD-122 QĐ11: 4 chỉ số kỹ thuật */
/* TD-126: Giao nhận thành phẩm (#/sx/kho-tp, public/js/sx-kho-tp.js) – dòng phiếu có Ảnh màu, khung cảnh báo vượt trước khi gửi */
.kt-dong { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; padding: 6px 0; border-top: 1px solid var(--line2, #EFEDE9); }
.kt-dong > .bt-dong { flex: 1 1 220px; margin: 0; } .kt-dong.r { align-items: center; } .kt-dong.r .bt-mo { flex: 1 1 60%; }
.kt-vuot { display: inline-flex; gap: 4px; flex-wrap: wrap; } .kt-vuot-ct { flex: 1 1 100%; display: flex; flex-direction: column; gap: 2px; color: var(--dh-bad); } .kt-vuot-ct > span { display: block; }   /* TD-143 */
.kt-dong .bt-dong select { flex: 1 1 110px; } .kt-dong .bt-dong select[aria-label="Size"] { flex: 0 1 76px; }
.kt-con { flex-basis: 100%; color: var(--muted); font-size: 12px; padding-left: 2px; }
.kt-anh, .kt-anh-o { flex: none; display: inline-flex; width: 44px; height: 44px; border-radius: 10px; overflow: hidden; background: var(--soft); }
.kt-anh-o:empty { display: none; } .kt-anh img { width: 100%; height: 100%; object-fit: cover; }
.kt-tong { margin-left: auto; font-size: 18px; font-weight: 800; color: var(--brand-ink); }
.kt-cb { margin: 8px 0; padding: 10px 12px; border-radius: 12px; background: var(--dh-warn-s); border: 1px solid #F0D58C; }
.kt-cb.chan { background: var(--dh-bad-s); border-color: #F2B8B0; } .kt-cb > b { display: block; margin-bottom: 4px; } .kt-cb .dh-row { border-top-color: rgba(0, 0, 0, .06); }
.kt-cb input { width: 100%; min-height: 44px; margin: 6px 0; border: 1px solid var(--line3, #CFCCC5); border-radius: 10px; padding: 0 10px; font-size: 15px; }
.dh-row.kt-l > span small { display: block; font-size: 12px; } .dh-row.kt-l .dh-bar { flex-basis: 100%; }
.bt-luoi-size { display: flex; flex-wrap: wrap; gap: 8px; } .bt-o-size { display: flex; flex-direction: column; gap: 2px; width: 7.5em; } .bt-o-size input { width: 100%; } .bt-o-size small { font-size: 12px; color: var(--muted); } .bt-anh-nho { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }   /* TD-140 */
