/* ============================================================
   CHẤM CÔNG — ND-2b (02/11/2026) nối danh mục: danh sách công trường (lọc, sắp xếp, «Chưa gắn mã»),
   form công trường dùng ô chọn danh mục (js/danhmuc.js), thẻ công trường nổi. CHỈ lớp .cc-* mới của mục
   Quản trị › Chấm công. Màu trạng thái dùng nhãn chung .cb .cb-* và token chung của app.css
   (--ink, --ink-2, --ink-3, --line, --primary, --primary-soft, --warn, --danger, --grey); không đặt màu riêng.
   Tránh tên đã có: .cc-chip, .cc-kho-, .cc-ngoai-toi, .cc-tc-goi.
   ============================================================ */
.cc-qt { min-width: 0; container-type: inline-size; container-name: ccqt; }
.cc-form-o select, .cc-form-o input, .cc-ct-loc select, .cc-ct-loc input, td.cc-ro-ct select { max-width: 100%; }
.cc-form-o > *, .cc-ct-loc-o > *, .cc-ct-tim > * { min-width: 0; max-width: 100%; }
.cc-an { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.cc-dm-thieu { min-height: 36px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 6px 10px; border: 1px dashed var(--line); border-radius: 8px; background: var(--grey); color: var(--ink-2); font-size: var(--fs-sm); }

/* ---------- Thanh lọc ---------- */
.cc-ct-loc { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 10px 0 8px; }
.cc-ct-tim { flex: 1 1 240px; max-width: 360px; }
.cc-ct-tim input { width: 100%; }
.cc-ct-loc-o { flex: 0 1 260px; min-width: 200px; }
.cc-ct-loc-tt { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--ink-2); }

/* ---------- Dòng tóm tắt: số công trường · «Chưa gắn mã: N» (bật/tắt lọc) · chú giải màu ---------- */
.cc-ct-tom { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 4px 0 8px; font-size: var(--fs-sm); color: var(--ink-2); }
.cc-ct-dem { font-weight: 600; color: var(--ink); }
.cc-ct-chuagan { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 600; cursor: pointer; }
.cc-ct-chuagan b { font-variant-numeric: tabular-nums; }
.cc-ct-chuagan:hover { background: var(--primary-soft); }
.cc-ct-chuagan.cc-ct-bat { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, #fff); box-shadow: inset 0 0 0 1px var(--warn); }
.cc-ct-chuagan:focus-visible, .cc-ct-sap:focus-visible, .cc-ct-ma:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.cc-ct-chugiai { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-left: auto; }
.cc-ct-chugiai .cb + .cb { margin-left: 0; }
.cc-ct-sapchon { display: none; align-items: center; gap: 6px; }

/* ---------- Bảng công trường (máy tính): cột cố định, chữ dài cắt «…», đủ chữ khi rê chuột (title) ---------- */
.cc-ct-wrap { margin-bottom: 4px; }
table.cc-ct-bang { width: 100%; table-layout: fixed; border-collapse: collapse; }
table.cc-ct-bang th, table.cc-ct-bang td { vertical-align: middle; }
table.cc-ct-bang th:nth-child(1) { width: 8%; }
table.cc-ct-bang th:nth-child(2) { width: 13%; }
table.cc-ct-bang th:nth-child(3) { width: 13%; }
table.cc-ct-bang th:nth-child(4) { width: 11%; }
table.cc-ct-bang th:nth-child(5) { width: 11%; }
table.cc-ct-bang th:nth-child(6) { width: 7%; }
table.cc-ct-bang th:nth-child(7) { width: 6%; }
table.cc-ct-bang th:nth-child(8) { width: 11%; }
table.cc-ct-bang th:nth-child(9) { width: 11%; }
table.cc-ct-bang th:nth-child(10) { width: 9%; }
table.cc-ct-bang th { padding: 0; }
.cc-ct-sap { display: flex; align-items: center; justify-content: space-between; gap: 4px; width: 100%; min-height: 34px; padding: 6px 8px; border: 0; border-radius: 0; background: transparent; color: inherit; font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.cc-ct-sap:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.cc-ct-mui { flex: 0 0 auto; font-size: 11px; color: var(--ink-3); }
.cc-ct-sap-dang .cc-ct-mui { color: var(--primary); }
table.cc-ct-bang th:nth-child(6) { padding: 8px 7px; }
table.cc-ct-bang th:last-child { padding: 8px 7px; }
table.cc-ct-bang td { padding: 7px 8px; border-top: 1px solid var(--line); }
.cc-ct-cat { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-ct-xn { white-space: normal; overflow-wrap: anywhere; line-height: 1.45; }
.cc-ct-so { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
th.cc-ct-so .cc-ct-sap { justify-content: flex-end; }
.cc-ct-tt { white-space: normal; line-height: 1.7; }
.cc-ct-tac { white-space: normal; text-align: right; }
.cc-ct-tac button { margin: 2px 0 2px 4px; }
.cc-ct-ma { padding: 2px 8px; border: 1px solid transparent; border-radius: 6px; background: var(--primary-soft); color: var(--primary); font: inherit; font-weight: 700; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: var(--fs-sm); cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-ct-ma:hover { border-color: var(--primary); }
tr.cc-ct-chua > td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
tr.cc-ct-ngung > td { color: var(--ink-3); }
tr.cc-ct-rong > td { text-align: center; padding: 18px 8px; }

/* ---------- Form công trường ---------- */
.cc-form { margin-top: 16px; padding: 14px 16px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; max-width: 1280px; }
.cc-form-td { margin: 0 0 12px; font-size: var(--fs-lg); color: var(--ink); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cc-form-luoi { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 16px; align-items: start; }
.cc-form-o { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.cc-form-o input { width: 100%; }
.cc-form-rong { grid-column: span 2; }
.cc-form-ca { grid-column: 1 / -1; }
.cc-form-nhan { font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); }
.cc-form-nut { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.cc-form .hint { margin-top: 10px; }

/* ---------- Roster: ô công trường (chip nhiều mã) ---------- */
td.cc-ro-ct { min-width: 240px; }
/* Lỗi 422 của dòng vừa gửi (mã công trường bị máy chủ từ chối): viền đỏ trong ô + thông báo .fv-err chung của app.css */
td.cc-ro-ct.fv-bad { box-shadow: inset 0 0 0 2px var(--danger); background: color-mix(in srgb, var(--danger) 6%, #fff); }
td.cc-ro-ct .cc-ro-loi { overflow-wrap: anywhere; }
.cc-nap-nhan { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--ink-2); }

/* ---------- Thẻ công trường nổi (Hồ sơ liên quan trang Dự án) ---------- */
.dlg-b.cc-the { display: block; }
.cc-the-ma { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: var(--fs-sm); color: var(--primary); font-weight: 700; margin-left: 6px; }
.cc-the-ds { display: grid; grid-template-columns: minmax(110px, max-content) minmax(0, 1fr); gap: 8px 16px; margin: 0; }
.cc-the-ds dt { color: var(--ink-3); font-size: var(--fs-sm); }
.cc-the-ds dd { margin: 0; overflow-wrap: anywhere; color: var(--ink); }

/* ---------- Khổ hẹp: theo bề rộng khung #ccQT (container query), không theo màn hình — vỏ 3 cột ăn bớt chỗ ---------- */
@media (max-width: 760px) {
  .cc-the-ds { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .cc-the-ds dd { margin-bottom: 8px; }
}
@container ccqt (max-width: 1100px) {
  .cc-form-luoi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cc-ct-chugiai { margin-left: 0; }
}
@container ccqt (max-width: 900px) {
  .cc-ct-tim, .cc-ct-loc-o { flex: 1 1 100%; max-width: none; min-width: 0; }
  .cc-ct-sapchon { display: inline-flex; }
  .cc-ct-wrap.wrap { border: 0; background: transparent; overflow: visible; }
  table.cc-ct-bang, table.cc-ct-bang tbody { display: block; width: 100%; table-layout: auto; }
  table.cc-ct-bang thead { display: none; }
  table.cc-ct-bang tr { display: block; margin: 0 0 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
  table.cc-ct-bang td { display: block; position: relative; min-height: 28px; padding: 5px 0 5px 122px; border-top: 0; white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; text-align: left; }
  table.cc-ct-bang td[data-nhan]::before { content: attr(data-nhan); position: absolute; left: 0; top: 7px; width: 112px; color: var(--ink-3); font-size: var(--fs-xs); font-weight: 600; }
  table.cc-ct-bang .cb { white-space: normal; max-width: 100%; }
  table.cc-ct-bang td.cc-ct-tac { padding: 8px 0 2px; text-align: right; border-top: 1px solid var(--line); margin-top: 4px; }
  table.cc-ct-bang td.cc-ct-tac::before { content: none; }
  tr.cc-ct-chua > td:first-child { box-shadow: none; }
  tr.cc-ct-chua { box-shadow: inset 4px 0 0 var(--warn); }
  tr.cc-ct-rong { text-align: center; }
  tr.cc-ct-rong > td { display: block; padding-left: 0; }
  .cc-form-luoi { grid-template-columns: minmax(0, 1fr); }
  .cc-form-rong, .cc-form-ca { grid-column: auto; }
  .cc-form { padding: 12px; }
}
