/* ============================================================================
   KC 0.9.7 — TIẾN TRÌNH · DẢI BƯỚC · TIẾN ĐỘ CHẾ TẠO (web/tien-trinh.js). Dùng biến màu của app.css.
   ========================================================================== */

/* ---------- dải bước (stepper) trang yêu cầu / đơn hàng ---------- */
.tt-dai { position: relative; display: grid; grid-template-columns: repeat(var(--n, 5), minmax(128px, 1fr)); background: var(--mat); border: 1px solid var(--vien);
  border-radius: var(--bo); box-shadow: var(--bong); margin-bottom: 12px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
.tt-b { position: relative; padding: 8px 11px 7px; border-right: 1px solid var(--vien); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tt-b.cuoi { border-right: 0; }
.tt-b-dau { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tt-cham { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: #eef2f7; color: var(--nhat); flex: none; }
.tt-cham .ic { width: 13px; height: 13px; stroke-width: 3; }
.tt-b.xong .tt-cham { background: var(--xanh); color: #fff; }
.tt-b.dang .tt-cham { background: var(--chinh); color: #fff; }
.tt-b.bo .tt-cham { background: transparent; border: 1px dashed var(--vien-2); color: var(--mo); }
.tt-b.bo .tt-b-gt, .tt-b.bo .tt-b-ten { color: var(--mo); }
.tt-b.xong.kq-truot .tt-cham, .tt-b.xong.kq-huy .tt-cham { background: var(--do); }
.tt-b.tre .tt-cham { background: var(--do); color: #fff; }
.tt-b-ten { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--nhat); line-height: 1.25; }
.tt-b-gt { font-weight: 600; font-size: 12.5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tt-b-gia { font-size: 12px; font-weight: 600; color: var(--chu-2); font-variant-numeric: tabular-nums; }
.tt-b-ngay { font-size: 11.5px; color: var(--nhat); display: flex; flex-wrap: wrap; gap: 1px 8px; font-variant-numeric: tabular-nums; }
.tt-b-ngay span { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.tt-b-ngay .ic { width: 11px; height: 11px; stroke-width: 3; }
.tt-b-ngay .xong { color: var(--xanh); }
.tt-b-ngay .tre { color: var(--do); font-weight: 600; }
.tt-b .hang-nut { margin-top: 3px; gap: 4px; }
/* bước hiện tại nổi bật: nền xanh nhạt + vạch trên; đang trễ thì đỏ */
.tt-b.hien { background: var(--chinh-nhat); box-shadow: inset 0 3px 0 var(--chinh); }
.tt-b.hien .tt-b-ten { color: var(--chinh-dam); }
.tt-b.hien.tre { background: var(--do-nhat); box-shadow: inset 0 3px 0 var(--do); }
.tt-b.hien.tre .tt-b-ten { color: var(--do); }
.tt-b.hien.xong { background: var(--xanh-nhat); box-shadow: inset 0 3px 0 var(--xanh); }
.tt-b.hien.xong .tt-b-ten { color: var(--xanh); }
.tt-b.hien.kq-truot, .tt-b.hien.kq-huy { background: var(--do-nhat); box-shadow: inset 0 3px 0 var(--do); }
.tt-b.hien.kq-truot .tt-b-ten, .tt-b.hien.kq-huy .tt-b-ten { color: var(--do); }
.tt-dai-chan { grid-column: 1 / -1; border-top: 1px solid var(--vien); padding: 5px 12px; display: flex; flex-wrap: wrap; gap: 3px 16px; font-size: 12.5px; color: var(--chu-2); background: var(--mat-2); }
.tt-dai-chan > span { display: inline-flex; align-items: center; gap: 5px; }
.tt-dai-chan .ic { width: 13px; height: 13px; color: var(--nhat); }
.tt-dai-chan .tt-do .ic { color: var(--do); }
.tt-do { color: var(--do); font-weight: 600; }

/* ---------- ô số đầu màn ---------- */
.tt-kpi { cursor: pointer; transition: border-color .12s; }
.tt-kpi:hover { border-color: #9fb0c6; }
.o-so .bieu.do-bieu { background: var(--do-nhat); color: var(--do); }
.o-so .gia-tri.tt-gia-tri { font-size: 15px; line-height: 1.3; }

/* ---------- thanh lọc ---------- */
.tt-cong-cu { gap: 8px 10px; }
.tt-chon { height: 30px; padding: 3px 8px; border: 1px solid var(--vien-2); border-radius: var(--bo-nho); background: var(--mat); max-width: 220px; font-size: 13px; }
.tt-tick { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--chu-2); cursor: pointer; white-space: nowrap; }
.tt-tick input { width: 16px; height: 16px; accent-color: var(--do); }
.tt-tick .ic { width: 14px; height: 14px; color: var(--do); }
.tt-tim { margin-left: auto; }
.tt-tim input { width: 260px; }

/* ---------- Kanban ---------- */
.tt-kanban { display: flex; gap: 10px; overflow-x: auto; padding: 10px 12px 12px; align-items: flex-start; scroll-snap-type: x proximity; overscroll-behavior-x: contain; }
.tt-cot { flex: 1 0 208px; min-width: 208px; max-width: 380px; background: var(--mat-2); border: 1px solid var(--vien); border-radius: var(--bo-nho);
  display: flex; flex-direction: column; max-height: calc(100vh - 230px); min-height: 120px; scroll-snap-align: start; }
.tt-cot.trong { flex: 0 0 100px; min-width: 100px; }
.tt-cot.trong .tt-cot-dau b { font-size: 11.5px; }
.tt-cot-dau { padding: 7px 10px; border-bottom: 1px solid var(--vien); display: flex; flex-direction: column; gap: 2px; }
.tt-cot-dau > div:first-child { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tt-cot-dau b { font-size: 12.5px; line-height: 1.25; }
.tt-cot-dau .dem { font-size: 11.5px; font-weight: 700; background: #e3e8ef; color: var(--chu-2); border-radius: 99px; padding: 0 7px; }
.tt-cot-dau .nhan { padding: 0 7px; font-size: 11px; }
.tt-cot-tong { font-size: 11.5px; color: var(--nhat); font-variant-numeric: tabular-nums; }
.tt-cot-ds { padding: 8px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.tt-cot-rong { color: var(--mo); text-align: center; padding: 8px 0; }
.tt-the { background: var(--mat); border: 1px solid var(--vien); border-left: 3px solid var(--chinh); border-radius: var(--bo-nho); padding: 7px 9px;
  cursor: pointer; box-shadow: var(--bong); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tt-the:hover, .tt-the:focus-visible { border-color: #9fb0c6; outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,.12), var(--bong); }
.tt-the.tre { border-left-color: var(--do); }
.tt-the.dong { border-left-color: var(--xanh); }
.tt-the-dau { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tt-the-dau b { font-size: 12.5px; word-break: break-word; }
.tt-the-dau .nhan { padding: 0 7px; font-size: 11px; }
.tt-lan { color: var(--nhat); font-weight: 600; font-variant-numeric: tabular-nums; }
.tt-the-kh { font-size: 12px; color: var(--chu-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt-the-ct { font-size: 12px; color: var(--chu); line-height: 1.35; }
.tt-the-pt .tien-do { min-width: 0; }
.tt-the-so { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 11.5px; color: var(--nhat); font-variant-numeric: tabular-nums; }
.tt-the-so span { display: inline-flex; align-items: center; gap: 3px; }
.tt-the-so .ic { width: 12px; height: 12px; }
.tt-the-gia { color: var(--chu-2); font-weight: 600; margin-left: auto; }
.tt-the-chan { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; margin-top: 1px; }
.tt-viec { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; }
.tt-viec .ic { width: 13px; height: 13px; }
.tt-viec-chu { color: var(--chu-2); font-weight: 500; cursor: help; }
.tt-viec-dai .tt-viec { font-weight: 500; }
.tt-sua { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--mo); white-space: nowrap; }
.tt-sua .ic { width: 11px; height: 11px; }
.tt-nhan-tre { cursor: help; }

/* ---------- bảng ---------- */
.tt-bang th.tt-sx { cursor: pointer; user-select: none; }
.tt-bang th.tt-sx:hover, .tt-bang th.on { color: var(--chinh); }
.tt-bang td { font-size: 12.5px; }
.tt-bang-ct { display: inline-block; max-width: 300px; line-height: 1.35; }
.bang tr.tt-tre td:first-child { box-shadow: inset 3px 0 0 var(--do); }

/* ---------- thẻ tiến độ chế tạo: lưới dòng × bước ---------- */
.tt-td .the-dau h2 { display: inline-flex; align-items: center; gap: 6px; }
.tt-han { display: inline-flex; align-items: center; gap: 4px; }
.tt-han .ic { width: 13px; height: 13px; }
.tt-luoi th.tt-th { text-align: center; min-width: 96px; cursor: help; }
.tt-luoi td { vertical-align: top; }
.tt-luoi td.tt-o { min-width: 96px; padding: 5px 7px; text-align: center; font-variant-numeric: tabular-nums; border-left: 1px solid var(--vien); }
.tt-luoi td.tt-o[role=button] { cursor: pointer; }
.tt-luoi td.tt-o[role=button]:hover, .tt-luoi td.tt-o[role=button]:focus-visible { background: #f2f7ff; outline: none; box-shadow: inset 0 0 0 2px rgba(37,99,235,.25); }
.tt-o-vach { height: 5px; border-radius: 99px; background: #e6ebf2; overflow: hidden; margin: 2px 0 3px; }
.tt-o-vach i { display: block; height: 100%; background: var(--chinh); border-radius: 99px; }
.tt-o.xong .tt-o-vach i { background: var(--xanh); }
.tt-o.tre .tt-o-vach i { background: var(--do); }
.tt-o-sl { font-size: 12px; font-weight: 600; white-space: nowrap; }
.tt-o-ngay { font-size: 11px; color: var(--nhat); white-space: nowrap; display: flex; justify-content: center; align-items: center; gap: 3px; min-height: 15px; }
.tt-o-ngay .ic { width: 11px; height: 11px; stroke-width: 3; }
.tt-o.xong .tt-o-ngay { color: var(--xanh); }
.tt-o.tre { background: var(--do-nhat); }
.tt-o.tre .tt-o-ngay { color: var(--do); font-weight: 600; }
.tt-o-ngay .goi-y { font-style: italic; }
.tt-tay { color: var(--tim); font-weight: 700; }
.tt-tay .ic { width: 11px; height: 11px; vertical-align: -1px; }
.tt-loi { color: var(--do); font-size: 11px; font-weight: 600; }
.tt-po { white-space: nowrap; }
.tt-luoi tr.tt-tre td:first-child { box-shadow: inset 3px 0 0 var(--do); }
.tt-luoi tfoot td { font-size: 12px; }
.tt-chu-giai { padding: 6px 12px; border-top: 1px solid var(--vien); font-size: 11.5px; color: var(--nhat); line-height: 1.5; }
.tt-chu-giai .ic { width: 12px; height: 12px; vertical-align: -2px; color: var(--mo); }

/* ---------- hộp sửa ---------- */
.hop.tt-hop { width: min(620px, 100%); }
.tt-hop-dau { margin-bottom: 8px; color: var(--chu); }
.tt-hop-suy { background: var(--mat-2); border: 1px solid var(--vien); border-radius: var(--bo-nho); padding: 7px 10px; margin-bottom: 10px; font-size: 12.5px; line-height: 1.5; }
.tt-hop-suy .ic { width: 12px; height: 12px; color: var(--xanh); vertical-align: -1px; }
.tt-hop .luoi select { height: 30px; }
.tt-cd { display: flex; flex-direction: column; gap: 6px; }
.tt-cd-dong { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tt-cd-dong input:not([type]), .tt-cd-dong input[name^=t_ten], .tt-cd-dong input[name^=g_ten] { flex: 1 1 180px; height: 30px; padding: 4px 9px; border: 1px solid var(--vien-2); border-radius: var(--bo-nho); }
.tt-cd-dong select { height: 30px; border: 1px solid var(--vien-2); border-radius: var(--bo-nho); padding: 3px 6px; max-width: 200px; }
.tt-cd-dong .o-chon { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; cursor: pointer; }
.tt-cd-goc { width: 120px; font-size: 12px; color: var(--nhat); }

@media (max-width: 860px) {
  .tt-dai { grid-template-columns: repeat(var(--n, 5), minmax(140px, 1fr)); }
  .tt-tim { margin-left: 0; flex: 1 1 100%; }
  .tt-tim input { width: 100%; }
  .tt-cot { max-height: none; }
}
@media (max-width: 560px) {
  /* ô số đầu màn: 2 cột, bỏ biểu tượng — đỡ chiếm cả màn điện thoại */
  .tt-chi-so { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tt-chi-so .o-so { padding: 8px 10px; }
  .tt-chi-so .o-so .bieu { display: none; }
  .tt-chi-so .o-so .gia-tri.tt-gia-tri { font-size: 13px; }
  .tt-cot { flex: 0 0 82vw; min-width: 82vw; }
  .tt-cot.trong { flex: 0 0 112px; min-width: 112px; }
  .tt-chon { flex: 1 1 40%; max-width: none; }
  .tt-cd-goc { width: 100%; }
}
