/* app.css — thành phần dùng chung giữa các trang (nút, thẻ, banner, bảng, ô lọc, hiệu ứng) — tách từ nhat-ky.css của 1.4
   để trang chủ / nhật ký thao tác / trang sau dùng lại mà không chép. Chỉ dùng token của tokens.css. */

* { font-family: var(--font-ui); }
.font-display { font-family: var(--font-display); }
.font-editor { font-family: var(--font-editor); }
.mono { font-family: var(--font-mono); font-size: 12px; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #9CA3AF; }

/* Nút */
.btn-primary { display: inline-flex; align-items: center; gap: 6px; background: var(--color-primary); color: #fff; font-weight: 600; border-radius: 7px; padding: 8px 14px; font-size: 13px; border: none; cursor: pointer; text-decoration: none; transition: background .15s, box-shadow .15s, transform .1s; }
.btn-primary:hover { background: var(--color-primary-dark); box-shadow: 0 4px 12px rgba(14,121,96,0.25); }
.btn-primary:active { transform: translateY(1px); box-shadow: none; }
.btn-primary[disabled] { opacity: .6; cursor: not-allowed; }
.btn-outline { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--color-border); color: var(--color-text-sub); font-weight: 600; border-radius: 7px; padding: 8px 14px; font-size: 13px; background: #fff; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, color .15s; }
.btn-outline:hover { border-color: var(--color-border-strong); color: var(--color-text-main); background: #F8F9FB; }
.btn-outline[disabled] { opacity: .6; cursor: not-allowed; }

/* Thẻ / khối */
.step-card { background: #fff; border: 1px solid var(--color-border); border-radius: 14px; padding: 20px 24px; margin-bottom: 20px; }
.step-title { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 17px; color: var(--color-text-main); margin: 0 0 14px; }
.step-title .step-no { width: 26px; height: 26px; border-radius: 8px; background: var(--color-primary-light); color: var(--color-primary); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-family: var(--font-ui); }
.page-wrap { max-width: 980px; margin: 0 auto; }
.page-wrap.is-narrow { max-width: 720px; }
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; border: 1px solid; margin-top: 12px; font-size: 13px; }
.banner.is-error { background: var(--color-error-light); border-color: #FECACA; color: #B91C1C; }
.banner.is-ok { background: var(--color-success-light); border-color: #BBF7D0; color: #14532D; }
.banner[hidden] { display: none; }
.select-lite { height: 32px; border: 1px solid var(--color-border); border-radius: 8px; padding: 0 8px; font-size: 12.5px; background: #fff; color: var(--color-text-main); }
.filter-input { height: 36px; border: 1px solid var(--color-border); border-radius: 8px; padding: 0 10px; font-size: 13px; font-family: var(--font-mono); min-width: 300px; background: #fff; }
.filter-input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(14,121,96,0.1); }
.kv { margin: 0; display: grid; grid-template-columns: 140px 1fr; row-gap: 8px; column-gap: 12px; font-size: 14px; }
.kv dt { color: var(--color-text-sub); }
.kv dd { margin: 0; color: var(--color-text-main); }
.badge { display: inline-block; padding: 2px 8px; border-radius: var(--radius-full); background: var(--color-primary-light); color: var(--color-primary); font-size: 12px; font-weight: 600; }
.form-col { display: flex; flex-direction: column; max-width: 420px; }
.form-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--color-text-sub); margin: 12px 0 6px; }
.form-input { height: 42px; padding: 0 12px; border: 1px solid var(--color-border); border-radius: var(--radius-lg); font: inherit; font-size: 14px; color: var(--color-text-main); background: var(--color-surface); outline: none; transition: border-color .15s, box-shadow .15s; }
.form-input:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(14, 121, 96, 0.12); }
.form-error { margin: 12px 0 0; padding: 10px 12px; border-radius: var(--radius-lg); background: var(--color-error-light); color: var(--color-error); font-size: 13px; line-height: 1.45; }
.form-success { margin: 12px 0 0; padding: 10px 12px; border-radius: var(--radius-lg); background: var(--color-success-light); color: var(--color-success); font-size: 13px; }
.form-warn { margin: 0 0 8px; padding: 10px 12px; border-radius: var(--radius-lg); background: var(--color-warning-light); color: var(--color-warning); font-size: 13px; line-height: 1.45; }
.note { color: var(--color-text-sub); font-size: 12.5px; line-height: 1.5; }
.note.is-bad { color: var(--color-error); font-weight: 600; }

/* Bảng nhật ký thao tác */
.audit-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.audit-table th { text-align: left; padding: 8px 10px; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--color-text-sub); background: #FAFBFC; border-bottom: 1px solid var(--color-border); white-space: nowrap; }
.audit-table td { padding: 8px 10px; border-bottom: 1px solid var(--color-background); vertical-align: top; }
.audit-table details summary { cursor: pointer; color: var(--color-primary); font-weight: 600; }
.audit-table pre { margin: 6px 0 0; font-size: 11px; white-space: pre-wrap; word-break: break-all; background: var(--color-background); padding: 6px 8px; border-radius: 6px; max-width: 420px; }

/* Hiệu ứng */
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.anim-slide-up { animation: slideUp .35s ease-out; }
.anim-fade { animation: fadeIn .25s ease-out; }
.spin { animation: spin 1s linear infinite; }

/* ───── Trang Nhập từ file (story 2.3) — màu lấy từ token của tokens.css; Tailwind là bản build TĨNH nên lớp nào thiếu thì viết ở đây.
   Ngoại lệ có chủ đích (palette chưa có token tương ứng): viền vàng nhạt #FEF0C7 của ô vàng (.cell-warn), và vòng focus rgba(...) = primary / warning
   ở độ mờ 12% (cùng giá trị với .form-input:focus của story 1.4). Ngoài ra không dùng màu thô. ───── */
.page-wrap.is-wide { max-width: 1280px; }
.form-info { margin: 0 0 8px; padding: 10px 12px; border-radius: var(--radius-lg); background: var(--color-primary-light); color: var(--color-primary); font-size: 13px; line-height: 1.45; }

/* Vùng thả tệp */
.drop-zone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 160px; padding: 24px 16px; box-sizing: border-box; text-align: center; border: 2px dashed var(--color-border-strong); border-radius: var(--radius-xl); background: var(--color-surface); cursor: pointer; transition: border-color .2s, background .2s; }
.drop-zone:hover, .drop-zone:focus-visible, .drop-zone.drag-over { border-color: var(--color-primary); background: var(--color-primary-light); }
/* Vùng thả là role="button" tabindex="0": bàn phím phải THẤY mình đang đứng ở đâu — viền token primary 2px, tách khỏi viền nét đứt bằng offset. */
.drop-zone:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.drop-zone p { margin: 0; }
.drop-icon { font-size: 36px; }
.drop-title { font-weight: 700; font-size: 15px; color: var(--color-text-main); }
.drop-link { color: var(--color-primary); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.drop-zone .drop-hint { margin-top: 4px; padding: 4px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-full); background: var(--color-background); color: var(--color-text-sub); font-size: 12px; }

/* Khung tệp + hộp cảnh báo */
.imp-file { padding: 12px 14px; border: 1px solid var(--color-border); border-radius: var(--radius-xl); background: var(--color-background); }
.imp-file-main { display: flex; align-items: center; gap: 10px; }
.imp-file-name { margin: 0; font-weight: 700; font-size: 14px; color: var(--color-text-main); overflow-wrap: anywhere; }
.imp-list { margin: 6px 0 0; padding: 0 0 0 18px; font-size: 12.5px; line-height: 1.5; }
.imp-list:empty { display: none; }
.imp-box-title { margin: 0 0 4px; font-weight: 700; }
.imp-banner-text { margin: 0; line-height: 1.45; overflow-wrap: anywhere; }

/* Biểu mẫu xem trước: lưới 2 cột (1 cột dưới 768px), không bị .form-col 420px bó */
.imp-grid { display: grid; grid-template-columns: 1fr; gap: 0 24px; }
.imp-span-2 { grid-column: 1 / -1; }
@media (min-width: 768px) { .imp-grid { grid-template-columns: 1fr 1fr; } }
.imp-grid .form-label { display: block; }
.imp-wide { width: 100%; max-width: 520px; box-sizing: border-box; }
.imp-check { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; color: var(--color-text-main); cursor: pointer; }
.imp-undo { padding-top: 12px; border-top: 1px solid var(--color-border); }

/* Bảng rộng (Hạng mục, Quỹ, Nhập gần đây): cuộn ngang trong khung, không phụ thuộc .page-wrap / .form-col */
.table-wide { overflow-x: auto; }
.table-wide table { min-width: 720px; }
.table-wide .items-table { min-width: 1080px; } /* = tổng min-width của 10 cột bên dưới (104+64+110+160+70+76+76+140+140+140) */
.items-table th { white-space: normal; line-height: 1.3; }
.items-table th, .items-table td { padding-left: 8px; padding-right: 8px; }
/* 10 cột: 1 hàng Excel (kèm nút "Bỏ hàng này") · 2 項次 · 3 Giai đoạn · 4 Hạng mục · 5 Thực hiện · 6-7 標準 · 8-9 ngày · 10 Ghi chú */
.items-table th:nth-child(1), .items-table td:nth-child(1) { min-width: 104px; }
.items-table th:nth-child(2), .items-table td:nth-child(2) { min-width: 64px; }
.items-table th:nth-child(3), .items-table td:nth-child(3) { min-width: 110px; }
.items-table th:nth-child(4), .items-table td:nth-child(4) { min-width: 160px; }
.items-table th:nth-child(5), .items-table td:nth-child(5) { min-width: 70px; }
.items-table th:nth-child(6), .items-table td:nth-child(6), .items-table th:nth-child(7), .items-table td:nth-child(7) { min-width: 76px; }
.items-table th:nth-child(8), .items-table td:nth-child(8), .items-table th:nth-child(9), .items-table td:nth-child(9) { min-width: 140px; }
.items-table th:nth-child(10), .items-table td:nth-child(10) { min-width: 140px; }
.items-table .badge { white-space: nowrap; }
.input-compact { height: 32px; width: 100%; min-width: 88px; padding: 0 8px; box-sizing: border-box; border: 1px solid var(--color-border); border-radius: 8px; font: inherit; font-size: 12.5px; color: var(--color-text-main); background: var(--color-surface); outline: none; }
.input-compact:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(14, 121, 96, 0.12); }
textarea.input-compact { height: auto; min-height: 56px; padding: 6px 8px; resize: vertical; }
input[type="date"].input-compact { min-width: 132px; }
.cell-warn { background: var(--color-warning-light); border-color: #FEF0C7; color: var(--color-warning); }
.cell-warn:focus { border-color: var(--color-warning); box-shadow: 0 0 0 3px rgba(181, 71, 8, 0.12); }
.input-compact[aria-invalid="true"] { border-color: var(--color-error); }
.cell-info, .items-table td.cell-info { position: relative; padding-left: 18px; }
.cell-info::before { content: ""; position: absolute; left: 7px; top: 13px; width: 6px; height: 6px; border-radius: var(--radius-full); background: var(--color-primary); }
.pre-line, .q-table th.pre-line { white-space: pre-line; overflow-wrap: anywhere; } /* .q-table th.pre-line: thắng `.audit-table th { white-space: nowrap }` cho tiêu đề dòng của hàng đợi */
.cell-raw { margin: 3px 0 0; font-size: 11.5px; color: var(--color-text-sub); overflow-wrap: anywhere; }
.cell-error { margin: 4px 0 0; padding: 4px 8px; font-size: 12px; }
.row-removed { opacity: .45; }
.row-removed .pre-line { text-decoration: line-through; }
.btn-compact { padding: 4px 10px; font-size: 12px; white-space: nowrap; }
.badge.is-sub { background: var(--color-background); color: var(--color-text-sub); }
/* Ô nhiều ngày: cụm "{n} ngày — Tách / Gộp" nằm trong ô ngày của dòng đầu; nút đang chọn (aria-pressed) đậm màu primary. */
.imp-multi { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 4px; }
.imp-multi .btn-outline[aria-pressed="true"] { border-color: var(--color-primary); background: var(--color-primary-light); color: var(--color-primary); }
/* Dòng con của ô đã Tách: thụt vào dưới dòng gốc, nền nhạt, mũi tên chỉ về dòng cha; 項次 / Giai đoạn / 標準 của dòng con mờ vì không sửa riêng. */
.items-table tr.row-child > td { background: var(--color-background); }
.items-table tr.row-child > td:first-child { padding-left: 20px; }
.row-child-mark { font-size: 16px; margin-right: 2px; vertical-align: middle; color: var(--color-text-sub); }
.cell-dim { color: var(--color-text-sub); }
/* Bản đọc bằng AI: ảnh xem nhanh để đối chiếu (cao tối đa 320 px, giữ tỉ lệ) nằm trên bảng Hạng mục. */
.imp-thumb-box { margin-top: 12px; }
.imp-thumb { display: block; max-width: 100%; max-height: 320px; object-fit: contain; border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--color-surface); }

/* ───── Trang Lịch trình (lich-trinh.html) — chỉ token của tokens.css; chip trạng thái dùng lớp Tailwind có sẵn (bg-*-light / text-*). ───── */
.sch-title-text { min-width: 0; overflow-wrap: anywhere; }
/* Chế độ xem đang chọn đọc từ aria-pressed — một nguồn cho trình đọc màn hình lẫn kiểu dáng. */
.sch-view[aria-pressed="true"] { border-color: var(--color-primary); background: var(--color-primary-light); color: var(--color-primary); }
/* Bảng 10 cột cuộn ngang TRONG khung overflow-x-auto (trang không cuộn ngang trên điện thoại; dòng thời gian là cách xem cho màn hẹp).
   Không dùng lại .items-table: lớp đó ghim min-width theo :nth-child cho bảng của trang nhập tệp. */
.sch-table { min-width: 1040px; }
.sch-table th { white-space: normal; line-height: 1.3; }
.sch-table td.sch-note { min-width: 220px; }
/* Dòng đã sửa chưa lưu: nền vàng nhạt + vạch trái; dòng vừa bị người khác sửa (phần nhập của mình đã bị bỏ): vạch trái đỏ. */
.sch-table tr.is-dirty td { background: var(--color-warning-light); }
.sch-table tr.is-dirty td:first-child { box-shadow: inset 3px 0 0 var(--color-warning); }
.sch-table tr.is-stale td:first-child { box-shadow: inset 3px 0 0 var(--color-error); }
.sch-more { margin-left: 6px; padding: 0; border: none; background: none; color: var(--color-primary); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.sch-more:hover { text-decoration: underline; }
/* Liên kết "Bắt đầu buổi" trong ô Hạng mục (story 3.3): chữ nhỏ cùng kiểu .sch-more, không phải .badge (ô Hạng mục chỉ có badge Mốc / BY CALL). */
.sch-start { font-size: 12px; font-weight: 600; color: var(--color-primary); text-decoration: none; white-space: nowrap; }
.sch-start:hover { text-decoration: underline; }

/* Dòng thời gian: danh sách dọc theo tháng — đường dọc bằng ::before, chấm trạng thái là phần tử con (Mốc = hình thoi), vạch "Hôm nay" nét đứt. */
.sch-timeline { list-style: none; margin: 0; padding: 0 0 0 24px; position: relative; }
.sch-timeline::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--color-border); }
.sch-tl-month, .sch-tl-unscheduled { margin: 16px 0 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--color-text-sub); }
.sch-tl-month:first-child { margin-top: 0; }
.sch-tl-item { position: relative; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 6px 0; font-size: 13px; color: var(--color-text-main); }
.sch-tl-dot { position: absolute; left: -21px; top: 11px; width: 10px; height: 10px; border-radius: var(--radius-full); background: var(--color-border-strong); box-shadow: 0 0 0 2px var(--color-surface); }
.sch-tl-dot.is-done { background: var(--color-success); }
.sch-tl-dot.is-overdue { background: var(--color-error); }
.sch-tl-dot.is-upcoming { background: var(--color-primary); }
.sch-tl-dot.is-moc { border-radius: 2px; transform: rotate(45deg); }
.sch-tl-date { min-width: 84px; font-family: var(--font-mono); font-size: 12px; color: var(--color-text-sub); }
.sch-tl-text { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.sch-tl-today { position: relative; margin: 6px 0 6px -24px; padding: 4px 0 0 24px; border-top: 2px dashed var(--color-primary); font-size: 12px; font-weight: 700; color: var(--color-primary); }

/* ───── Trang Dự án (du-an.html) — chỉ token của tokens.css. Lưới 2 cột từ 768px, 1 cột dưới; khối nhiều cột (Quỹ, Người liên hệ, Phân công, Lịch sử) chiếm cả hàng và bảng cuộn ngang TRONG khung. ───── */
.p360-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 768px) { .p360-grid { grid-template-columns: 1fr 1fr; } .p360-card.is-wide { grid-column: 1 / -1; } }
.p360-card { min-width: 0; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 14px; padding: 16px 20px; }
.p360-stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.p360-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.p360-card-head .p360-card-title { margin: 0; }
.p360-card-head .btn-outline { margin-left: auto; }
.p360-card-title { margin: 0 0 12px; font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--color-text-main); }
.p360-card .kv { grid-template-columns: minmax(96px, 140px) 1fr; }
.p360-card .kv dd { min-width: 0; overflow-wrap: anywhere; }
.p360-draft-list { list-style: none; margin: 0; padding: 0; }
.p360-draft-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--color-border); }
.p360-draft-row:first-child { border-top: 0; padding-top: 0; }
.p360-draft-row > div { min-width: 0; flex: 1 1 180px; }
.p360-draft-title { font-weight: 600; color: var(--color-text-main); overflow-wrap: anywhere; }

/* ───── Trang Case sửa chương trình (case.html): ô nhiều dòng cùng kiểu .form-input (cao tự do, kéo dọc được, rộng hết khung). ───── */
.case-textarea { height: auto; min-height: 84px; padding: 8px 12px; width: 100%; max-width: none; box-sizing: border-box; resize: vertical; line-height: 1.45; }
/* Nút chữ "Xem đủ / Thu gọn" cạnh mô tả / ghi chú bị cắt trong bảng Case. */
.case-more { margin-left: 6px; padding: 0; border: 0; background: none; color: var(--color-primary); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.case-more:hover { text-decoration: underline; }
.case-more:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; border-radius: 2px; }

/* ───── Trang Vấn đề (van-de.html) + thẻ "Vấn đề" trên trang Dự án — chỉ token của tokens.css. Bảng 10 cột cuộn ngang TRONG khung overflow-x-auto (trang không cuộn ngang trên điện thoại). ───── */
.iss-title-text { min-width: 0; overflow-wrap: anywhere; }
.iss-textarea { height: auto; min-height: 84px; padding: 8px 12px; width: 100%; max-width: none; box-sizing: border-box; resize: vertical; line-height: 1.45; }
.iss-table { min-width: 980px; }
.iss-table th { white-space: normal; line-height: 1.3; }
.iss-more { margin-left: 6px; padding: 0; border: 0; background: none; color: var(--color-primary); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.iss-more:hover { text-decoration: underline; }
.iss-more:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; border-radius: 2px; }
/* Dòng lịch sử chèn dưới dòng Vấn đề: nền nhạt, mỗi lần chuyển một dòng; nhãn "mở lại" nằm sát cuối dòng. */
.iss-history td { background: var(--color-background); }
.iss-hist-list { list-style: none; margin: 0; padding: 0; }
.iss-hist-list li { padding: 4px 0; overflow-wrap: anywhere; }
.iss-hist-tag { margin-left: 6px; }
/* Thẻ Vấn đề: mỗi dòng chưa giải quyết = nội dung cắt (trái) + hạn + chip trạng thái (phải), thu xuống dòng trên màn hẹp. */
.p360-issue-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--color-border); }
.p360-issue-row:first-child { border-top: 0; padding-top: 0; }
.p360-issue-row > div { min-width: 0; flex: 1 1 180px; overflow-wrap: anywhere; }
/* Trang Dự án 360° bản đầy đủ (epic "Bảng điều khiển" ticket 3): nhóm Rủi ro · Ngoại lệ đối chiếu · Dòng thời gian Buổi. Màn rộng: hàng co giãn (flex-wrap — thẻ ẩn không giữ chỗ):
   Rủi ro (1 phần) và Ngoại lệ (2 phần) cạnh nhau, không kéo cao bằng nhau; Dòng thời gian .is-wide cả hàng; tab ẩn. Màn hẹp: một cột + tab (dùng lại .rc-tabs / .rc-tab của trang
   đối chiếu — tab chọn có gạch dưới); thẻ không được chọn mang .is-tab-off và CHỈ bị ẩn dưới 768 px. [hidden] viết lại vì lớp đặt display (flex) thắng thuộc tính hidden. */
.p360-r2a { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; }
.p360-r2a[hidden], .p360-r2a > .p360-tabs[hidden] { display: none; }
.p360-r2a > .p360-card { flex: 1 1 280px; }
.p360-r2a > #p360-recon { flex: 2 1 420px; }
.p360-r2a > .p360-tabs, .p360-r2a > .p360-card.is-wide { flex-basis: 100%; margin-top: 0; }
@media (min-width: 768px) { .p360-r2a > .p360-tabs { display: none; } }
@media (max-width: 767px) { .p360-r2a > .p360-card { flex-basis: 100%; } .p360-r2a > .is-tab-off { display: none; } }
/* Ngoại lệ đối chiếu: bảng trong khung cuộn (cao tối đa ~ 8 dòng; Kỳ nhiều Ngoại lệ không đẩy dài trang). */
.p360-recon-scroll { max-height: 360px; overflow: auto; }
.p360-recon-table { min-width: 420px; }
/* Dòng thời gian: bảng trong khung cuộn (cao tối đa ~ 12 dòng, cuộn ngang trong khung trên điện thoại); dòng "Hiện tại" nền nhạt + chữ đậm (không chỉ đổi màu); dòng đang chọn
   so sánh có vạch trái. Chip Mức nhỏ như bảng Cảnh báo. */
.p360-tl-scroll { max-height: 460px; overflow: auto; }
.p360-tl-table { min-width: 640px; }
.p360-tl-table td.num, .p360-cmp-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.p360-tl-table .rk-chip, .p360-recon-table .rk-chip { padding: 1px 10px; font-size: 12.5px; }
.p360-tl-table tr.is-current > td { background: var(--color-primary-light); font-weight: 600; }
.p360-tl-table tr.is-picked > td:first-child { box-shadow: inset 3px 0 0 var(--color-primary); }
.p360-tl-pick { width: 18px; height: 18px; accent-color: var(--color-primary); cursor: pointer; }
.p360-tl-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
/* Bảng chênh lệch: <caption> nêu A → B; Δ tốt / xấu tô màu KÈM chữ (.p360-cmp-dir), trung lập không tô. */
.p360-cmp-table caption { caption-side: top; text-align: left; padding: 10px 10px 6px; font-size: 13px; font-weight: 700; color: var(--color-text-main); }
.p360-cmp-table tbody th[scope="row"] { text-align: left; white-space: normal; font-size: 12.5px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--color-text-main); background: transparent; border-bottom: 1px solid var(--color-background); }
.p360-cmp-table td.is-tot { color: var(--color-success); }
.p360-cmp-table td.is-xau { color: var(--color-error); }
.p360-cmp-dir { margin-left: 6px; font-size: 11.5px; font-weight: 600; }

/* ───── Trang Việc cần làm (viec.html) — chỉ token của tokens.css; dùng lại .iss-title-text, .iss-more, .form-warn. Bảng 5 cột cuộn ngang TRONG khung overflow-x-auto (trang không cuộn ngang trên điện thoại). ───── */
.viec-textarea { height: auto; min-height: 84px; padding: 8px 12px; width: 100%; max-width: none; box-sizing: border-box; resize: vertical; line-height: 1.45; }
/* Viết kèm .table-wide: một mình .viec-table thua .table-wide table về độ ưu tiên CSS. */
.table-wide .viec-table { min-width: 760px; }

/* ───── Trang Báo biểu hiệu quả (bao-bieu.html) — chỉ token của tokens.css. Bảng 6 cột cuộn ngang TRONG khung overflow-x-auto (trang không cuộn ngang trên điện thoại). ───── */
.bb-title-text { min-width: 0; overflow-wrap: anywhere; }
.bb-table { min-width: 860px; }
.bb-table th { white-space: normal; line-height: 1.3; }
/* Chức năng chỉ in ở dòng đầu nhóm (như ô gộp của sheet 效益報表); vạch ngăn nhóm cho dễ dò theo hàng. */
.bb-table td.bb-group { font-weight: 600; color: var(--color-text-main); }
.bb-table tr.is-group-start td { border-top: 2px solid var(--color-border-strong); }
.bb-table td.bb-note { min-width: 220px; }
/* Dòng đã sửa chưa lưu: nền vàng nhạt + vạch trái; dòng vừa bị người khác sửa (phần nhập của mình đã bị bỏ): vạch trái đỏ. */
.bb-table tr.is-dirty td { background: var(--color-warning-light); }
.bb-table tr.is-dirty td:first-child { box-shadow: inset 3px 0 0 var(--color-warning); }
.bb-table tr.is-stale td:first-child { box-shadow: inset 3px 0 0 var(--color-error); }

/* ───── Trang ký tại chỗ (ky.html — ticket 15) — vỏ TRẦN (không sidebar / header), dùng trên tablet và điện thoại; chỉ token của tokens.css. ───── */
.ky-body { margin: 0; min-height: 100vh; background: var(--color-background); color: var(--color-text-main); font-family: var(--font-ui); }
.ky-main { max-width: 920px; margin: 0 auto; padding: 56px 16px 32px; box-sizing: border-box; }
.ky-card { margin-top: 12px; }
.ky-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.ky-review-subject { margin: 6px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.ky-warnings { list-style: none; margin: 12px 0 0; padding: 0; }
.ky-warning { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 10px 0; border-top: 1px solid var(--color-border); }
.ky-warning:first-child { border-top: 0; }
.ky-warning-main { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; line-height: 1.45; }
.ky-warning-ai { margin-top: 4px; white-space: pre-wrap; }
.ky-warning-acts { display: flex; gap: 6px; flex: 0 0 auto; }
.ky-warning.is-ignored .ky-warning-text { color: var(--color-text-sub); text-decoration: line-through; }
/* Bước 2: chiếm cả màn hình (body.ky-fullscreen) — nút ngôn ngữ nổi vẫn còn, không có liên kết nào. */
.ky-sign { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 14px; padding: 18px 20px; }
body.ky-fullscreen .ky-main { max-width: none; padding-top: 52px; }
.ky-sign-title { margin: 0 0 12px; font-size: 19px; font-weight: 700; }
.ky-memo { border: 1px solid var(--color-border); border-radius: 10px; padding: 12px 14px; max-height: 46vh; overflow-y: auto; background: var(--color-background); font-size: 14px; line-height: 1.5; }
.ky-kv { margin: 0; display: grid; grid-template-columns: 150px 1fr; row-gap: 6px; column-gap: 12px; }
.ky-kv dt { color: var(--color-text-sub); }
.ky-kv dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.ky-memo-sec { margin-top: 12px; }
.ky-memo-h { margin: 0 0 4px; font-size: 14px; font-weight: 700; }
.ky-prose { white-space: pre-wrap; overflow-wrap: anywhere; }
.ky-prose.is-empty, .ky-rows .is-empty { color: var(--color-text-sub); }
.ky-rows { margin: 0; padding-left: 18px; }
.ky-rows li { overflow-wrap: anywhere; white-space: pre-wrap; }
.ky-form { display: flex; flex-direction: column; margin-top: 8px; }
.ky-form .form-input { width: 100%; max-width: 520px; box-sizing: border-box; }
/* Khung ký: touch-action none — kéo ngón tay để ký, không cuộn / phóng trang. Kích thước vẽ cố định 900×300, hiển thị co theo bề rộng và LUÔN 3:1 (mọi cỡ màn) —
   khác tỉ lệ thì ảnh gửi lên / nhúng PDF bị méo so với điều khách thấy. */
.ky-pad { display: block; width: 100%; max-width: 900px; height: auto; aspect-ratio: 3 / 1; background: #fff; border: 2px dashed var(--color-border-strong); border-radius: 10px; touch-action: none; -webkit-user-select: none; user-select: none; cursor: crosshair; box-sizing: border-box; }
.ky-sign-btn { min-width: 120px; justify-content: center; }
.ky-done-code { font-size: 16px; }
/* Ticket 16 — trang khách ký qua link (ky-online.html): ô nhập ≥ 16 px (iOS không phóng to khi chạm), lỗi của ô chỉ hiện sau khi bấm "Ký" / rời ô (trang đặt
   aria-invalid; :user-invalid của trình duyệt cũng tô viền). Lỗi dưới ô là chữ đỏ nhỏ, không phải khung lỗi. */
.kyo-form .form-input { font-size: 16px; }
.kyo-form .form-input[aria-invalid="true"], .kyo-form .form-input:user-invalid { border-color: var(--color-error); }
.kyo-form .ky-pad[aria-invalid="true"] { border-color: var(--color-error); }
.kyo-field-error { margin: 6px 0 0; color: var(--color-error); font-size: 13px; line-height: 1.45; }
@media (max-width: 640px) {
  .ky-main { padding: 52px 12px 24px; }
  .ky-sign { padding: 14px 12px; }
  .ky-kv { grid-template-columns: 1fr; }
  .ky-kv dt { margin-top: 6px; }
  .ky-actions > * { flex: 1 1 100%; justify-content: center; }
  .ky-warning-acts { flex: 1 1 100%; }
}

/* Ticket 17 — trang "Thời gian nhập": bảng tuần có <caption> + <th scope>, cuộn ngang trong khung riêng trên điện thoại (trang không cuộn ngang). */
.table-scroll { overflow-x: auto; border: 1px solid var(--color-border); border-radius: 12px; max-width: 100%; }
.table-scroll:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.etm-table caption { caption-side: top; text-align: left; padding: 10px 10px 6px; font-size: 13px; font-weight: 700; color: var(--color-text-main); }
.etm-table th.num, .etm-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.etm-table tbody th[scope="row"] { text-align: left; white-space: nowrap; font-size: 12.5px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--color-text-main); background: transparent; border-bottom: 1px solid var(--color-background); }
.etm-weeks { height: 36px; border: 1px solid var(--color-border); border-radius: 8px; padding: 0 10px; font-size: 13px; background: var(--color-surface); color: var(--color-text-main); }
/* Ticket 17 — trang Vấn đề: dòng mở từ chip "Có thể trùng" của nhật ký (?issue=<id>) được tô tới khi tải lại trang. */
tr.is-target > td { background: var(--color-warning-light); }
tr.is-target > td:first-child { box-shadow: inset 3px 0 0 var(--color-warning); }

/* ───── Epic 4 ticket 2 — trang "Hàng đợi của tôi" (queue.html): ba bảng Vấn đề / Việc / Case, đổi trạng thái tại dòng. Chỉ token của tokens.css.
   Khung cuộn (.table-scroll .q-wrap, role="region" + tabindex="0") là CONTAINER: khi chính khung hẹp hơn 640px (điện thoại, cửa sổ hẹp) bảng thành thẻ — <thead> ẩn, mỗi ô in nhãn
   cột từ data-label (queue.js đặt theo i18n) bằng ::before; <th scope="row"> thành đầu thẻ. Rộng thì là bảng thường, cuộn ngang trong khung (trang không cuộn ngang). ───── */
.q-section { margin-top: 24px; }
.q-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 8px; font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--color-text-main); }
.q-wrap { container-type: inline-size; }
.q-table { min-width: 860px; }
.q-table tbody th[scope="row"] { min-width: 200px; max-width: 360px; text-align: left; vertical-align: top; font-size: 12.5px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--color-text-main); background: transparent; border-bottom: 1px solid var(--color-background); }
.q-table .q-kind { margin-left: 6px; }
.q-change { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 190px; }
.q-change .select-lite, .q-change .input-compact { width: 100%; max-width: 260px; }
.q-change .cell-error { margin: 0; }
.q-field { display: flex; flex-direction: column; gap: 2px; width: 100%; }
.q-field[hidden] { display: none; }
.q-label { font-size: 11px; font-weight: 700; color: var(--color-text-sub); }
@container (width < 640px) {
  .q-table { min-width: 0; }
  .q-table, .q-table tbody, .q-table tr, .q-table th, .q-table td { display: block; }
  .q-table thead { display: none; } /* tiêu đề cột ẩn khỏi bố cục lẫn trình đọc màn hình — nhãn nằm ở từng ô */
  .q-table tr { margin: 10px; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-surface); }
  .q-table tbody th[scope="row"] { min-width: 0; max-width: none; padding: 0 0 8px; margin-bottom: 4px; font-size: 13px; border-bottom: 1px solid var(--color-border); }
  .q-table td { padding: 6px 0; border-bottom: 0; }
  .q-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 2px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--color-text-sub); }
  .q-change { min-width: 0; }
  .q-change .select-lite, .q-change .input-compact { max-width: none; }
}

/* ───── R1a — trang "Hôm nay" (today.html, FR-40): thẻ "Dự án của tôi", khối "Sắp hạn" (hai bảng dùng lại .q-wrap / .q-table của Hàng đợi — hẹp hơn 640 px thì dòng thành thẻ),
   "Buổi đang soạn" (dùng lại .p360-draft-*). Chỉ token của tokens.css. Lưới thẻ 1 cột, từ 768 px 2 cột (như .p360-grid). Thẻ là <article>: <header> (mã — liên kết sang trang
   Dự án —, khách, trạng thái, vai) · <dl class="kv"> · <footer> có "Bắt đầu buổi". Nhóm chuẩn bị / tạm dừng / kết thúc nằm trong <details> gốc (thu gọn, không heading trong
   <summary>). Quá hạn / Quỹ âm luôn có CHỮ ("quá hạn", dấu trừ) — màu chỉ để nhìn nhanh. ───── */
.td-section { margin-top: 24px; }
.td-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 768px) { .td-grid { grid-template-columns: 1fr 1fr; } }
.td-grid[hidden] { display: none; }
.td-card { min-width: 0; display: flex; flex-direction: column; gap: 12px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 14px; padding: 16px 20px; }
.td-card-head { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.td-card-title { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 15px; line-height: 1.35; color: var(--color-text-main); overflow-wrap: anywhere; }
.td-card-title .mono { font-size: 13px; }
.td-card-customer { margin: 0; overflow-wrap: anywhere; }
.td-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.td-card .kv { grid-template-columns: minmax(96px, 140px) 1fr; row-gap: 6px; font-size: 13px; }
.td-card .kv dd { min-width: 0; overflow-wrap: anywhere; }
.td-card .kv dd.td-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.td-budget { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.td-neg { color: var(--color-error); font-weight: 600; }
.td-card-foot { margin-top: auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.td-card-foot .btn-primary { min-block-size: 32px; }
.td-other { margin-top: 16px; }
.td-other > summary { cursor: pointer; min-block-size: 24px; padding: 6px 0; font-weight: 600; font-size: 13px; color: var(--color-text-main); }
.td-other > summary:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; border-radius: 4px; }
.td-other[open] > summary { margin-bottom: 12px; }
.td-empty-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.td-empty-links .material-symbols-outlined { font-size: 16px; }
.td-caption { caption-side: top; text-align: left; padding: 10px 10px 6px; font-size: 13px; font-weight: 700; color: var(--color-text-main); }
.td-caption .badge { margin-left: 8px; }
@container (width < 640px) {
  .td-caption { display: block; } /* bảng thành khối (mẫu .q-table) — caption giữ đầu khung */
}
@media (max-width: 767px) {
  .td-card { padding: 14px; }
  .td-card-foot .btn-primary { flex: 1 1 100%; justify-content: center; }
}

/* ───── R1b — Tổng quan giám đốc (dashboard.html, FR-38): bộ lọc (nhóm ô chọn trạng thái trong <fieldset> + ba <select> có <label> + ô xếp) và lưới thẻ Dự án. Chỉ token của
   tokens.css. Lưới auto-fill ≥ 280 px (min(100%, 280px) — không tràn ngang trên màn hẹp), 1 cột dưới 768 px. Mỗi thẻ là MỘT <a> bọc <article> (một đích, không control lồng);
   <article> là container (container-type) — thẻ hẹp thì cặp nhãn / giá trị xếp dọc. Thanh % là div role="progressbar" rộng theo style.width do trang đặt. Chip "Trễ Mốc" /
   "Vấn đề > 14 ngày" luôn có CHỮ; đỏ (text-error) khi > 0 — màu chỉ để nhìn nhanh. ───── */
.db-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin-top: 12px; }
.db-filter { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.db-filter-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--color-text-sub); }
.db-filter .select-lite { min-width: 180px; max-width: 100%; height: 36px; font-size: 13px; }
.db-status { flex: 1 1 100%; min-width: 0; margin: 0; padding: 0; border: 0; }
.db-status[hidden] { display: none; }
.db-status > legend { padding: 0; margin-bottom: 6px; }
.db-status-list { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.db-status-opt { display: inline-flex; align-items: center; gap: 6px; min-block-size: 24px; font-size: 13px; color: var(--color-text-main); cursor: pointer; }
.db-status-opt input { inline-size: 16px; block-size: 16px; margin: 0; accent-color: var(--color-primary); }
.db-grid { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 16px; }
.db-grid[hidden] { display: none; }
/* Epic "Bảng điều khiển" ticket 4: <li> = thẻ (MỘT <a>) + dòng Ngoại lệ RIÊNG bên dưới (anh em, không lồng) — cột flex để thẻ vẫn kéo dài bằng hàng. */
.db-item { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.db-card-link { display: block; flex: 1 1 auto; color: inherit; text-decoration: none; border-radius: 14px; }
.db-card-link:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.db-card { container-type: inline-size; box-sizing: border-box; height: 100%; display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 14px; transition: border-color .15s, box-shadow .15s; }
.db-card-link:hover .db-card { border-color: var(--color-border-strong); box-shadow: 0 2px 8px rgba(17, 22, 33, 0.06); }
.db-card-head { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.db-card-title { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 15px; line-height: 1.35; color: var(--color-text-main); overflow-wrap: anywhere; }
.db-card-title .mono { font-size: 13px; color: var(--color-primary); }
.db-card-customer { margin: 0; overflow-wrap: anywhere; }
.db-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.db-card .kv { grid-template-columns: minmax(88px, 120px) 1fr; row-gap: 6px; font-size: 13px; }
.db-card .kv dd { min-width: 0; overflow-wrap: anywhere; }
.db-progress-dd { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.db-progress { flex: 0 0 auto; width: 96px; height: 6px; border-radius: var(--radius-full); background: var(--color-background); overflow: hidden; }
.db-progress-fill { height: 100%; background: var(--color-primary); }
.db-budget { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
/* Epic "Bảng điều khiển" ticket 4: dấu ghi đè Mức (dùng lại .rk-override-mark — icon + CHỮ) cỡ chip; liên kết Ngoại lệ đối chiếu (đầu trang + dưới thẻ) có icon + chữ, gạch dưới khi
   hover / focus — không chỉ màu. */
.db-chips .db-override { padding: 1px 8px; font-size: 12px; }
.db-chips .db-override .material-symbols-outlined { font-size: 15px; }
.db-exc { margin-bottom: 0; font-size: 13px; }
.db-exc[hidden] { display: none; }
.db-item-foot { margin: 0; padding: 0 4px; font-size: 13px; }
.db-exc-link { display: inline-flex; align-items: center; gap: 6px; min-block-size: 24px; color: var(--color-warning); font-weight: 600; text-decoration: none; border-radius: 6px; }
.db-exc-link:hover { text-decoration: underline; }
.db-exc-link:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; text-decoration: underline; }
.db-exc-link .material-symbols-outlined { font-size: 18px; }
@container (width < 300px) {
  .db-card .kv { grid-template-columns: 1fr; row-gap: 2px; }
  .db-card .kv dd { margin-bottom: 4px; }
}
@media (max-width: 767px) {
  .db-grid { grid-template-columns: 1fr; }
  .db-filter { flex: 1 1 100%; }
  .db-filter .select-lite { width: 100%; min-width: 0; }
  .db-card { padding: 12px 14px; }
}

/* ───── Epic 4 ticket 4 — trang "Thống kê Vấn đề" (thong-ke-van-de.html): thẻ tổng quan + bảng tuần / phân bố / tuổi + danh sách khi bấm số. Chỉ token của tokens.css.
   Con số là <button class="st-num"> (vùng bấm ≥ 24 px, lớn hơn trên màn cảm ứng; viền focus :focus-visible); thanh tỷ lệ .st-bar là div trang trí (aria-hidden, rộng theo
   style.width do trang đặt). Thẻ mở lại vượt ngưỡng (.st-card.is-alert): nền --color-error-light + viền / chữ đỏ + chữ "Vượt ngưỡng 5 %" (không chỉ màu) — nền đặt ở ĐÂY vì
   lớp tiện ích bg-error-light của Tailwind nằm trong @layer nên thua .st-card (không layer). Khung danh sách (.st-list-wrap,
   role="region" + tabindex="0") là CONTAINER: hẹp hơn 640 px thì mỗi dòng thành thẻ, nhãn cột từ data-label (::before) — trang không cuộn ngang. ───── */
.st-section { margin-top: 24px; }
.st-scope { min-width: 260px; max-width: 100%; height: 36px; font-size: 13px; }
.st-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); gap: 12px; margin: 0; }
.st-card { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 12px 14px; border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--color-surface); }
.st-card.is-sub { background: var(--color-background); }
.st-card.is-alert { border-color: var(--color-error); background: var(--color-error-light); }
.st-card-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--color-text-sub); }
.st-card.is-alert .st-card-label { color: var(--color-error); }
.st-card-value { margin: 0; }
.st-card-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; margin: 0; font-size: 12px; color: var(--color-text-sub); }
.st-num { min-inline-size: 24px; min-block-size: 24px; padding: 0 4px; border: 0; border-radius: 6px; background: transparent; color: var(--color-primary); font: inherit; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; }
.st-num:hover { text-decoration-color: currentColor; }
.st-num:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.st-card .st-card-value .st-num { font-size: 22px; font-weight: 700; }
.st-card.is-alert .st-num { color: var(--color-error); }
.st-card.is-alert .st-num:focus-visible { outline-color: var(--color-error); }
.st-flag { flex-basis: 100%; font-weight: 600; }
.st-flag.is-alert { color: var(--color-error); }
.st-table caption { caption-side: top; text-align: left; padding: 10px 10px 6px; font-size: 13px; font-weight: 700; color: var(--color-text-main); }
.st-table th.num, .st-table td.num { text-align: right; white-space: nowrap; }
.st-table tbody th[scope="row"] { text-align: left; white-space: normal; font-size: 12.5px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--color-text-main); background: transparent; border-bottom: 1px solid var(--color-background); }
.st-table td.num .st-num { font-size: 13px; }
.st-bar { width: 100%; min-width: 64px; max-width: 160px; height: 6px; margin: 4px 0 0 auto; border-radius: var(--radius-full); background: var(--color-background); overflow: hidden; }
.st-bar-fill { height: 100%; background: var(--color-primary); }
tr.st-unclassified > th, tr.st-unclassified > td { border-top: 1px dashed var(--color-border-strong); background: #FAFBFC; }
.st-dist-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; }
#st-list-title:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.st-list-wrap { container-type: inline-size; }
.st-list-table { min-width: 860px; }
.st-list-table tbody th[scope="row"] { min-width: 220px; max-width: 360px; vertical-align: top; }
.st-list-table .st-kind { margin-left: 6px; }
@media (pointer: coarse) {
  .st-num { min-block-size: 32px; min-inline-size: 32px; }
}
@container (width < 640px) {
  .st-list-table { min-width: 0; }
  .st-list-table, .st-list-table tbody, .st-list-table tr, .st-list-table th, .st-list-table td { display: block; }
  .st-list-table thead { display: none; } /* tiêu đề cột ẩn khỏi bố cục lẫn trình đọc màn hình — nhãn nằm ở từng ô */
  .st-list-table tr { margin: 10px; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-surface); }
  .st-list-table tbody th[scope="row"] { min-width: 0; max-width: none; padding: 0 0 8px; margin-bottom: 4px; font-size: 13px; border-bottom: 1px solid var(--color-border); }
  .st-list-table td { padding: 6px 0; border-bottom: 0; }
  .st-list-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 2px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--color-text-sub); }
}

/* ───── Epic 4 ticket 6 — trang "Trợ lý AI" (tro-ly.html): danh sách lượt hỏi đáp (role="log"), chip ngữ cảnh, <details> "Dữ liệu đã tra", thẻ đề xuất (người bấm "Xác nhận"),
   ô nhập <textarea> + nút gửi. Chỉ token của tokens.css. Lượt của người dùng dồn phải / nền --color-background, lượt trợ lý trải rộng (nhận focus, viền :focus-visible). Thẻ đã
   xác nhận (.asst-card.is-done): viền / nền xanh + chữ "Đã tạo Việc" (không chỉ màu). Dưới 768 px: một cột, nút gửi rộng hết hàng (vỏ đã thu sidebar). ───── */
.asst-context { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 4px 10px; border-radius: var(--radius-full); background: var(--color-primary-light); color: var(--color-primary); font-size: 12.5px; font-weight: 600; }
.asst-log { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.asst-log:empty { display: none; }
.asst-turn { box-sizing: border-box; max-width: 100%; border: 1px solid var(--color-border); border-radius: 12px; padding: 10px 14px; background: var(--color-surface); }
.asst-turn.is-user { align-self: flex-end; max-width: min(100%, 720px); border-color: transparent; background: var(--color-background); }
.asst-turn.is-ai { align-self: stretch; }
.asst-turn.is-ai:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.asst-turn.is-fail { border-color: #FECACA; background: var(--color-error-light); }
.asst-who { margin: 0 0 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--color-text-sub); }
.asst-text { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--color-text-main); overflow-wrap: anywhere; }
.asst-text + .asst-text { margin-top: 6px; }
.asst-meta { margin: 8px 0 0; }
.asst-sources { margin-top: 8px; font-size: 12.5px; }
.asst-sources summary { cursor: pointer; color: var(--color-primary); font-weight: 600; }
.asst-sources summary:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; border-radius: 4px; }
.asst-sources ul { margin: 4px 0 0; padding-left: 18px; }
.asst-sources li { margin: 3px 0; overflow-wrap: anywhere; }
.asst-sources-h { margin: 8px 0 0; font-weight: 700; color: var(--color-text-main); }
.asst-cards { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.asst-card { border: 1px dashed var(--color-border-strong); border-radius: 10px; padding: 10px 12px; background: #FAFBFC; }
.asst-card[hidden] { display: none; }
.asst-card.is-done { border-style: solid; border-color: var(--color-success); background: var(--color-success-light); }
.asst-card-title { margin: 0 0 4px; font-size: 13px; font-weight: 700; color: var(--color-text-main); }
.asst-card-text { margin: 0 0 6px; font-size: 13px; overflow-wrap: anywhere; }
.asst-card .q-field { max-width: 360px; margin-top: 6px; }
.asst-card .q-field .select-lite { width: 100%; }
.asst-card .cell-error { margin-top: 6px; }
.asst-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.asst-busy { margin-top: 10px; }
.asst-form { margin-top: 16px; }
.asst-input { display: block; width: 100%; box-sizing: border-box; min-height: 72px; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-lg); font: inherit; font-size: 14px; line-height: 1.5; color: var(--color-text-main); background: var(--color-surface); resize: vertical; outline: none; transition: border-color .15s, box-shadow .15s; }
.asst-input:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(14, 121, 96, 0.12); }
.asst-input[disabled] { opacity: .7; }
.asst-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
@media (max-width: 767px) {
  .asst-turn.is-user { max-width: 100%; }
  .asst-actions .btn-primary { width: 100%; justify-content: center; }
  .asst-card .q-field { max-width: none; }
}

/* ───── Epic 4 ticket 7 — Thư viện giải pháp (giai-phap.html) + panel gợi ý khi gõ Vấn đề mới (solution-suggest.js, dùng ở van-de.html và nhat-ky.html). Chỉ token của tokens.css.
   Danh sách là thẻ <li> có <button> chiếm cả thẻ (aria-pressed = đang mở); chi tiết nằm cạnh (hai cột từ 960px, một cột dưới). Panel gợi ý là <ul role="list"> dưới ô nội dung. ───── */
.sol-filters { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; }
.sol-filter { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sol-filter-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--color-text-sub); }
.sol-filter-q { flex: 1 1 260px; }
.sol-q { height: 36px; max-width: none; width: 100%; }
.sol-layout { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 12px; }
@media (min-width: 960px) { .sol-layout { grid-template-columns: minmax(280px, 2fr) 3fr; } }
.sol-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sol-card-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; width: 100%; padding: 10px 12px; text-align: left; border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-surface); font: inherit; color: var(--color-text-main); cursor: pointer; }
.sol-card-btn:hover { border-color: var(--color-border-strong); background: #F8F9FB; }
.sol-card-btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.sol-card.is-active .sol-card-btn { border-color: var(--color-primary); box-shadow: inset 3px 0 0 var(--color-primary); }
.sol-card-title { font-size: 14px; }
.sol-card-chips, .sol-d-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.sol-detail { min-width: 0; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 14px; padding: 16px 20px; }
.sol-d-title { margin: 0 0 8px; font-family: var(--font-display); font-weight: 700; font-size: 17px; color: var(--color-text-main); }
.sol-d-title:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.sol-h { margin: 14px 0 4px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--color-text-sub); }
.sol-prose { font-size: 14px; line-height: 1.55; color: var(--color-text-main); }
.sol-para { margin: 0 0 8px; }
.sol-wide { width: 100%; max-width: none; box-sizing: border-box; }
.sol-textarea { height: auto; min-height: 140px; padding: 8px 12px; width: 100%; max-width: none; box-sizing: border-box; resize: vertical; line-height: 1.45; }
.sol-box { margin-top: 12px; padding: 12px 14px; border: 1px dashed var(--color-border-strong); border-radius: 10px; background: #FAFBFC; }
.sol-suggest { margin-top: 8px; padding: 10px 12px; border: 1px dashed var(--color-border-strong); border-radius: 10px; background: var(--color-primary-light); }
.sol-suggest[hidden] { display: none; }
.sol-suggest-title { margin: 0 0 6px; font-size: 12px; font-weight: 700; color: var(--color-primary); }
.sol-suggest-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sol-suggest-item { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-surface); }
.sol-suggest-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.sol-suggest-name { font-size: 13px; color: var(--color-text-main); overflow-wrap: anywhere; }
.sol-suggest-mod { font-size: 11.5px; color: var(--color-text-sub); }
.sol-suggest-sum { margin: 0; font-size: 12.5px; color: var(--color-text-sub); overflow-wrap: anywhere; }
.sol-suggest-use { align-self: flex-start; }

/* ===== Rủi ro (epic "Cảnh báo rủi ro sớm" ticket 3 — rui-ro.html, cau-hinh-rui-ro.html, khối Rủi ro của du-an.html). Chip Mức luôn kèm CHỮ; màu cột biểu đồ lấy token. ===== */
.rk-body { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }
.rk-level-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.rk-chip { display: inline-flex; align-items: center; padding: 3px 12px; border-radius: var(--radius-full); font-size: 14px; font-weight: 700; white-space: nowrap; }
.rk-score { font-size: 14px; font-weight: 600; color: var(--color-text-main); font-variant-numeric: tabular-nums; }
.rk-override-mark { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border: 1px dashed var(--color-border-strong); border-radius: var(--radius-full); font-size: 12.5px; font-weight: 600; color: var(--color-text-main); }
.rk-override-mark[hidden] { display: none; }
.rk-override-mark .material-symbols-outlined { font-size: 16px; }
.rk-form { max-width: 520px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--color-border); display: flex; flex-direction: column; }
.rk-form[hidden] { display: none; }
.rk-textarea { height: auto; min-height: 84px; padding: 8px 12px; resize: vertical; line-height: 1.45; }
.rk-notices { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.55; }
.rk-caption { caption-side: top; text-align: left; padding: 10px 10px 6px; font-size: 13px; font-weight: 700; color: var(--color-text-main); }
.rk-table th.num, .rk-table td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rk-table tbody th[scope="row"] { text-align: left; white-space: nowrap; font-size: 12.5px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--color-text-main); }
.rk-table td.rk-threshold { min-width: 220px; color: var(--color-text-sub); }
.rk-table tr.rk-on td, .rk-table tr.rk-on th { background: var(--color-error-light); }
.rk-state { font-size: 12px; color: var(--color-text-sub); }
.rk-state.is-on { font-weight: 700; color: var(--color-error); }
.rk-figure { margin: 0; }
.rk-chart { width: 100%; max-width: 760px; }
.rk-svg { display: block; width: 100%; height: auto; }
.rk-svg .rk-grid { stroke: var(--color-border); stroke-width: 1; }
.rk-svg .rk-axis { fill: var(--color-text-sub); font-size: 11px; font-family: var(--font-ui); }
.rk-svg .rk-bar { fill: var(--color-border-strong); }
.rk-svg .rk-bar.is-xanh { fill: var(--color-success); }
.rk-svg .rk-bar.is-vang { fill: var(--color-warning); }
.rk-svg .rk-bar.is-do { fill: var(--color-error); }
.rk-svg .rk-band { stroke-width: 1.5; stroke-dasharray: 6 4; }
.rk-svg .rk-band.is-vang { stroke: var(--color-warning); }
.rk-svg .rk-band.is-do { stroke: var(--color-error); }
.rk-svg .rk-band-label { font-size: 11px; font-weight: 700; font-family: var(--font-ui); }
.rk-svg .rk-band-label.is-vang { fill: var(--color-warning); }
.rk-svg .rk-band-label.is-do { fill: var(--color-error); }
.rk-signal-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.cfg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 12px 16px; }
.cfg-field { display: flex; flex-direction: column; min-width: 0; }
.cfg-num { max-width: 160px; }
.cfg-table { min-width: 860px; }
.cfg-table th, .cfg-table td { vertical-align: top; }
.cfg-table input[type="checkbox"] { inline-size: 18px; block-size: 18px; margin-top: 6px; accent-color: var(--color-primary); }
.cfg-params { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 12px; min-width: 320px; }
.cfg-param { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cfg-plabel { font-size: 11px; font-weight: 700; color: var(--color-text-sub); }
.cfg-r3 { margin-left: 6px; }
.cfg-in-use { margin-left: 6px; }
.cfg-err { margin: 4px 0 0; color: var(--color-error); font-size: 12px; line-height: 1.4; }
.cfg-err[hidden] { display: none; }
.cfg-num[aria-invalid="true"], .form-input[aria-invalid="true"] { border-color: var(--color-error); }
@media (max-width: 767px) { .rk-form { max-width: none; } .cfg-num { max-width: none; } }

/* Cảnh báo rủi ro trong app (epic "Cảnh báo rủi ro sớm" ticket 4 — FR-26): dòng Cảnh báo ở trang rủi ro (rui-ro.html) và khối "Cảnh báo rủi ro" của "Hôm nay". Viền trái đỏ =
   chưa xác nhận (luôn kèm chữ "Chưa ai xác nhận" / nút "Đã xem" — màu chỉ để nhìn nhanh). */
.ra-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ra-list[hidden] { display: none; }
.ra-item { min-width: 0; display: flex; flex-direction: column; gap: 6px; padding: 10px 14px; background: var(--color-surface); border: 1px solid var(--color-border); border-left: 4px solid var(--color-error); border-radius: 10px; }
.ra-item.is-acked { border-left-color: var(--color-border-strong); }
.ra-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; color: var(--color-text-main); }
.ra-project { font-weight: 600; overflow-wrap: anywhere; }
.ra-project .mono { font-size: 12.5px; }
.ra-date { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ra-kind { font-weight: 700; }
.ra-levels { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.ra-levels .rk-chip { padding: 1px 10px; font-size: 12.5px; }
.ra-arrow { color: var(--color-text-sub); }
.ra-signals, .ra-status { margin: 0; font-size: 12.5px; line-height: 1.5; overflow-wrap: anywhere; }
.ra-status { color: var(--color-text-sub); }
.ra-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ra-form { max-width: 520px; display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px solid var(--color-border); }
@media (max-width: 639px) {
  .ra-item { padding: 10px 12px; }
  .ra-actions .btn-outline, .ra-actions .btn-primary { flex: 1 1 auto; justify-content: center; }
}

/* Sổ rủi ro và biện pháp (epic "Cảnh báo rủi ro sớm" ticket 7 — FR-29): nhóm theo Tín hiệu (tiêu đề + số biện pháp), dòng dùng khung .ra-item với viền trái màu chính
   (đang mở) / viền xám (đã đóng); trạng thái / quá hạn luôn có CHỮ. Chữ dữ liệu đặt bằng textContent (pages/rui-ro.js). */
.rm-groups { display: flex; flex-direction: column; gap: 14px; }
.rm-groups[hidden] { display: none; }
.rm-group-title { margin: 0 0 6px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 14px; font-weight: 700; color: var(--color-text-main); }
.rm-group-count { font-size: 12px; font-weight: 600; color: var(--color-text-sub); }
.rm-item { border-left-color: var(--color-primary); }
.rm-item.is-closed { border-left-color: var(--color-border-strong); }
.rm-text { margin: 0; font-size: 14px; line-height: 1.55; color: var(--color-text-main); overflow-wrap: anywhere; }
.rm-item .rk-chip { padding: 1px 10px; font-size: 12.5px; }
.rm-person { overflow-wrap: anywhere; }
/* Chip "Biện pháp · <Tín hiệu>" ở Hàng đợi / Hôm nay (dưới nội dung Việc). */
.q-mit-chip { display: inline-block; margin-top: 4px; }

/* Tường thuật rủi ro bằng AI (epic "Cảnh báo rủi ro sớm" ticket 6 — FR-28): khung viền trái màu AI (token --color-ai-*); nhãn "AI tạo, cần kiểm tra" luôn có CHỮ; cảnh báo số lạ màu
   cảnh báo kèm chữ + biểu tượng. Chữ AI đặt bằng textContent (pages/rui-ro.js). */
.rn-box { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; background: var(--color-surface); border: 1px solid var(--color-border); border-left: 4px solid var(--color-ai-accent); border-radius: 10px; }
.rn-box[hidden] { display: none; }
.rn-head { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.rn-ai-label { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: var(--radius-full); background: var(--color-ai-light); color: var(--color-ai-accent); font-size: 12px; font-weight: 700; }
.rn-ai-label .material-symbols-outlined { font-size: 16px; }
.rn-meta { font-size: 12px; color: var(--color-text-sub); overflow-wrap: anywhere; }
.rn-meta[hidden] { display: none; }
.rn-warn { margin-top: 0; background: var(--color-warning-light); border-color: var(--color-warning); color: var(--color-text-main); }
.rn-text { display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 1.6; color: var(--color-text-main); overflow-wrap: anywhere; }
.rn-text p { margin: 0; }
.rn-sub { margin: 4px 0 0; font-size: 12px; font-weight: 700; color: var(--color-text-sub); }
.rn-sources { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.rn-sources[hidden] { display: none; }
.rn-rate { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 8px; border-top: 1px solid var(--color-border); font-size: 13px; }

/* ───── Đối chiếu giờ công (epic "Đối chiếu giờ công ba nguồn" ticket 1 — FR-30 / FR-37): doi-chieu.html. Chỉ token của tokens.css. Hai cột từ 900 px (danh sách Kỳ | Kỳ đang
   mở), hẹp hơn thì xếp chồng. Tab: nút role="tab" trên một hàng (cuộn ngang khi chật — không xuống dòng); tab đang chọn tô màu chính KÈM gạch dưới bằng viền của ::after (không
   chỉ màu; viền vẫn hiện ở chế độ màu cưỡng bức), không đổi kích thước tab. Khung bảng (.table-scroll .rc-wrap, role="region" + tabindex="0") là CONTAINER: hẹp hơn 640 px thì mỗi
   dòng thành thẻ — <thead> ẩn, ô in nhãn cột từ data-label bằng ::before, <th scope="row"> thành đầu thẻ. ───── */
.rc-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; margin-top: 16px; }
@media (min-width: 900px) { .rc-layout { grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); } }
.rc-open { display: flex; flex-direction: column; gap: 4px; padding-bottom: 12px; margin-bottom: 4px; border-bottom: 1px solid var(--color-border); }
.rc-open[hidden] { display: none; }
.rc-open-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rc-month { flex: 1 1 140px; min-width: 0; max-width: 200px; height: 36px; }
.rc-period-list { margin: 8px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.rc-period { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 8px 10px; border: 1px solid var(--color-border); border-left: 4px solid var(--color-border); border-radius: 10px; background: var(--color-surface); color: var(--color-text-main); text-decoration: none; }
.rc-period:hover { border-color: var(--color-border-strong); }
.rc-period:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.rc-period.is-selected { border-left-color: var(--color-primary); background: var(--color-primary-light); }
.rc-period-label { font-weight: 700; font-size: 14px; }
.rc-period-count { flex-basis: 100%; font-size: 12px; color: var(--color-text-sub); }
.rc-main { min-width: 0; }
.rc-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rc-head .q-title { margin: 0; }
.rc-tabs { display: flex; gap: 4px; margin-top: 12px; overflow-x: auto; border-bottom: 1px solid var(--color-border); }
.rc-tab { position: relative; flex: none; padding: 8px 12px; border: 0; background: transparent; font-size: 13.5px; font-weight: 600; color: var(--color-text-sub); cursor: pointer; white-space: nowrap; }
.rc-tab:hover { color: var(--color-text-main); }
.rc-tab:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -2px; }
.rc-tab[aria-selected="true"] { color: var(--color-primary); }
.rc-tab[aria-selected="true"]::after { content: ""; position: absolute; inset: auto 0 0; border-bottom: 3px solid var(--color-primary); }
.rc-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin-top: 12px; }
.rc-wrap { container-type: inline-size; }
.rc-wrap[hidden] { display: none; }
.rc-table { width: 100%; min-width: 720px; }
.rc-table caption { caption-side: top; text-align: left; padding: 10px 10px 6px; font-size: 13px; font-weight: 700; color: var(--color-text-main); }
.rc-table th.num, .rc-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rc-table tbody th[scope="row"] { text-align: left; white-space: nowrap; font-size: 12.5px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--color-text-main); background: transparent; border-bottom: 1px solid var(--color-background); }
.rc-quy { display: block; font-weight: 700; }
.rc-sub { display: block; font-size: 11.5px; color: var(--color-text-sub); white-space: normal; }
@container (width < 640px) {
  .rc-table { min-width: 0; }
  .rc-table, .rc-table tbody, .rc-table tr, .rc-table th, .rc-table td { display: block; }
  .rc-table thead { display: none; } /* tiêu đề cột ẩn khỏi bố cục lẫn trình đọc màn hình — nhãn nằm ở từng ô */
  .rc-table tr { margin: 10px; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-surface); }
  .rc-table tbody th[scope="row"] { padding: 0 0 8px; margin-bottom: 4px; font-size: 13px; border-bottom: 1px solid var(--color-border); }
  .rc-table td { padding: 6px 0; border-bottom: 0; }
  .rc-table td.num { text-align: left; }
  .rc-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 2px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--color-text-sub); }
}
.rc-m-tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin-top: 12px; }
.rc-m-upload { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rc-m-upload[hidden] { display: none; }
.rc-m-file { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.rc-m-file:focus-visible + .rc-m-pick { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.rc-subhead { margin: 20px 0 4px; font-size: 13.5px; font-weight: 700; color: var(--color-text-main); } /* tab CRM (epic 7 ticket 3): "Các lô đã nạp" dưới bảng dòng C */
/* tab Ngoại lệ (epic 7 ticket 4): ô chế độ khớp + nút "Khớp lại" (recon.manage, Kỳ đang mở) cùng một hàng, hẹp thì xuống dòng; dòng tổng đậm. */
.rc-x-manage { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; }
.rc-x-manage[hidden] { display: none; }
.rc-x-summary { font-size: 13.5px; font-weight: 700; color: var(--color-text-main); }
/* Epic "Bảng điều khiển" ticket 4: bộ lọc Dự án (?projectId= từ Tổng quan) — chữ + nút bỏ lọc. */
.rc-x-project { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 13px; color: var(--color-text-main); }
.rc-x-project[hidden] { display: none; }
.rc-table tr.rc-x-gone { color: var(--color-text-sub); } /* Ngoại lệ đã đóng mà lần khớp cuối không còn sinh — kèm ghi chú chữ ở ô trạng thái */
/* epic 7 ticket 5: nút của thẻ Kỳ (Xuất Excel / Chốt / Mở lại) đẩy sang phải, hẹp thì xuống dòng; hàng xử lý Ngoại lệ ngay dưới dòng (nền nhạt + vạch trái — không chỉ đổi màu); khối
   "được giao cho tôi" là danh sách thẻ; Ngoại lệ mở từ hàng đợi (?exception=) có vạch đậm. */
.rc-head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.rc-table tr.rc-xp-row > td { background: var(--color-background); white-space: normal; }
.rc-xp { display: flex; flex-direction: column; gap: 10px; padding: 8px 4px 8px 12px; border-left: 3px solid var(--color-primary); }
.rc-xp-title { margin: 0; font-size: 12.5px; font-weight: 700; color: var(--color-text-main); }
.rc-xp-history { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--color-text-sub); }
.rc-xp-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; }
.rc-xp-form { display: flex; flex-direction: column; gap: 6px; max-width: 640px; }
.rc-xp-field { display: flex; flex-direction: column; gap: 2px; }
.rc-xp-ai { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.rc-xp-ai-out { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border: 1px dashed var(--color-border-strong); border-radius: 8px; background: var(--color-surface); }
.rc-xp-ai-out p { margin: 0; white-space: pre-line; }
.rc-mine { margin-bottom: 8px; }
.rc-mine[hidden], .rc-layout[hidden] { display: none; }
.rc-mine-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.rc-mine-item { padding: 10px 12px; border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-surface); }
.rc-mine-item.is-focus { border-left: 4px solid var(--color-primary); }
.rc-mine-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rc-d-num { width: 7rem; }
.rc-d-note { min-width: 10rem; margin: 2px 0 4px; }

/* ───── Nạp Bản ghi CRM tập đoàn (nap-crm.html — epic 7 ticket 3, FR-32): bước 1 tệp | dán bảng cạnh nhau (hẹp thì xếp dọc); bước 2 khung ánh xạ + bảng dòng (thành thẻ khi hẹp — dùng
   .rc-table); dòng còn phải xử lý có vạch trái cảnh báo, dòng đã bỏ mờ + gạch ngang (không chỉ đổi màu). ───── */
.nc-step { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--color-border); }
.nc-step[hidden] { display: none; }
.nc-source { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px 24px; margin-top: 8px; align-items: start; }
.nc-box { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.nc-file { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; } /* ô tệp thật: ẩn khỏi mắt, vẫn nhận Tab */
.nc-file:focus-visible + .nc-pick { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.nc-pick[aria-disabled="true"] { opacity: .6; pointer-events: none; }
.nc-paste { width: 100%; box-sizing: border-box; height: auto; min-height: 120px; padding: 8px 12px; font-family: var(--font-mono, ui-monospace, monospace); font-size: 12.5px; resize: vertical; }
.nc-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; }
.nc-map { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-background); }
.nc-map-summary { cursor: pointer; font-size: 13.5px; font-weight: 700; color: var(--color-text-main); }
.nc-map-summary:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.nc-map-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 8px 16px; margin-top: 8px; }
.nc-map-select { width: 100%; }
.nc-check { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13.5px; color: var(--color-text-main); cursor: pointer; }
.nc-check input { inline-size: 18px; block-size: 18px; accent-color: var(--color-primary); }
.nc-loai-table { min-width: 0; }
.nc-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 12px; }
.nc-tools .nc-check { margin-top: 0; }
.nc-table { min-width: 900px; }
.nc-table tr.nc-todo > th[scope="row"] { box-shadow: inset 4px 0 0 var(--color-warning); padding-left: 10px; }
.nc-table tr.nc-dropped > th, .nc-table tr.nc-dropped > td { opacity: .55; text-decoration: line-through; }
.nc-table tr.nc-dropped > td:last-child { text-decoration: none; opacity: 1; }
.nc-choose { display: block; width: 100%; max-width: 280px; margin-top: 4px; }
.nc-orig { overflow-wrap: anywhere; }
.nc-person { overflow-wrap: anywhere; }
.nc-drop { inline-size: 18px; block-size: 18px; accent-color: var(--color-primary); }

/* ───── Nhập Bản ký giấy (ban-ky.html — epic 7 ticket 2, FR-31): ảnh bên trái, biểu mẫu bên phải; hẹp thì xếp dọc ───── */
.bk-layout { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 24px; margin-top: 16px; align-items: start; }
.bk-layout[hidden] { display: none; }
.bk-view, .bk-form { min-width: 0; }
.bk-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.bk-figure { margin: 0; }
.bk-img { display: block; max-width: 100%; height: auto; border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-background); }
.bk-pdf { padding: 16px; border: 1px dashed var(--color-border-strong); border-radius: 10px; }
.bk-figure figcaption { margin-top: 6px; overflow-wrap: anywhere; }
.bk-page-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.bk-add { margin-top: 12px; }
.bk-file { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; } /* ô tệp thật: ẩn khỏi mắt, vẫn nhận Tab */
.bk-file:focus-visible + .bk-drop { outline: 2px solid var(--color-primary); outline-offset: 2px; border-color: var(--color-primary); }
.bk-drop { min-height: 110px; padding: 16px; }
.bk-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bk-row .bk-input { flex: 1 1 180px; min-width: 0; }
.bk-input { width: 100%; box-sizing: border-box; }
.bk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 0 16px; }
.bk-field { min-width: 0; }
.bk-pending { display: inline-block; margin-left: 4px; padding: 1px 6px; border-radius: var(--radius-full); background: var(--color-warning-light); color: var(--color-warning); font-size: 10px; letter-spacing: .02em; text-transform: none; vertical-align: middle; }
.bk-pending[hidden] { display: none; }
.bk-sign { margin: 4px 0 0; padding: 0; border: 0; min-width: 0; }
.bk-sign legend { padding: 0; }
.bk-radio { display: inline-flex; align-items: center; gap: 6px; margin: 4px 16px 4px 0; font-size: 14px; color: var(--color-text-main); cursor: pointer; }
.bk-radio input { inline-size: 18px; block-size: 18px; accent-color: var(--color-primary); }
.bk-note { height: auto; min-height: 64px; padding: 8px 12px; resize: vertical; }
.bk-goiy { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-background); }
.bk-subtitle { margin: 0 0 6px; font-size: 12.5px; font-weight: 700; color: var(--color-text-main); }
.bk-goiy-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.bk-goiy-item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; font-size: 13px; }
.bk-goiy-text { min-width: 0; overflow-wrap: anywhere; }
.bk-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.bk-supersede { margin-top: 12px; padding-top: 4px; border-top: 1px solid var(--color-border); }
.bk-new { margin-top: 16px; max-width: 640px; } /* epic 7 ticket 6: ban-ky.html?session= — tải Bản ký đầu tiên cho một Buổi */
/* Trích tự động Bản ký bằng AI (epic "Đối chiếu giờ công ba nguồn" ticket 7 — R3): khối AI (viền trái màu AI, trạng thái + chi phí ước tính), nhãn "AI đọc (%)" cạnh ô điền sẵn,
   nút gợi ý số ngày (không tự điền), khung bbox đè lên ảnh trang (vị trí theo % — JS đặt style.left / top / width / height; không inline style trong HTML). Màu chỉ từ token AI. */
.bk-frame { position: relative; width: fit-content; max-width: 100%; }
.bk-boxes { position: absolute; inset: 0; pointer-events: none; }
.bk-box { position: absolute; box-sizing: border-box; border: 2px solid var(--color-ai-accent); border-radius: 3px; background: rgba(91, 33, 182, 0.06); pointer-events: auto; cursor: pointer; }
.bk-box.is-active { border-width: 3px; background: rgba(91, 33, 182, 0.2); box-shadow: 0 0 0 2px var(--color-surface); z-index: 1; }
.bk-box-label { position: absolute; left: -2px; bottom: 100%; padding: 0 4px; border-radius: 3px 3px 0 0; background: var(--color-ai-accent); color: var(--color-surface); font-size: 10px; line-height: 14px; white-space: nowrap; opacity: 0; }
.bk-box.is-active .bk-box-label, .bk-box:hover .bk-box-label { opacity: 1; }
.bk-ai { margin: 8px 0 12px; padding: 10px 12px; border: 1px solid var(--color-border); border-left: 4px solid var(--color-ai-accent); border-radius: 10px; background: var(--color-surface); }
.bk-ai[hidden] { display: none; }
.bk-ai-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; }
.bk-ai-head .bk-subtitle { display: inline-flex; align-items: center; gap: 4px; margin: 0; }
.bk-ai-status { padding: 2px 10px; border-radius: var(--radius-full); background: var(--color-ai-light); color: var(--color-ai-accent); font-size: 12px; font-weight: 700; }
.bk-ai-actions { margin-top: 8px; }
.bk-ai-tag { display: inline-block; margin-left: 4px; padding: 1px 6px; border-radius: var(--radius-full); background: var(--color-ai-light); color: var(--color-ai-accent); font-size: 10px; letter-spacing: .02em; text-transform: none; vertical-align: middle; }
.bk-ai-tag[hidden] { display: none; }
.bk-ai-suggest { display: inline-block; margin-top: 4px; padding: 2px 8px; border: 1px dashed var(--color-ai-accent); border-radius: 6px; background: var(--color-ai-light); color: var(--color-ai-accent); font-size: 12px; cursor: pointer; }
.bk-ai-suggest[hidden] { display: none; }
.bk-ai-suggest:disabled { opacity: .6; cursor: default; }
.bk-ai-hint { color: var(--color-ai-accent); }

/* ===== Bản tin thứ Hai (ban-tin.html — epic "Bảng điều khiển" ticket 6): danh sách tuần (trái) + nội dung AI (khung rn-box của tường thuật 6.6) + bảng số liệu đã dùng ===== */
.bt-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.bt-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.bt-layout[hidden] { display: none; }
@media (min-width: 900px) { .bt-layout { grid-template-columns: 240px minmax(0, 1fr); } }
.bt-sub { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--color-text-sub); }
.bt-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.bt-item { box-sizing: border-box; width: 100%; min-block-size: 40px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; text-align: left; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 10px; font-size: 13px; color: var(--color-text-main); cursor: pointer; }
.bt-item:hover { border-color: var(--color-border-strong); }
.bt-item:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.bt-item.is-current { border-color: var(--color-primary); background: var(--color-primary-light); font-weight: 700; }
.bt-item-week { flex: 1 1 auto; }
.bt-badge { padding: 1px 8px; border-radius: var(--radius-full); background: var(--color-primary-light); color: var(--color-primary-dark); font-size: 11px; font-weight: 700; }
.bt-badge.is-warn { background: var(--color-warning-light); color: var(--color-text-main); border: 1px solid var(--color-warning); }
.bt-view { min-width: 0; }
.bt-view[hidden] { display: none; }
.bt-view:focus { outline: none; }
.bt-view-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.bt-title { margin: 0; font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--color-text-main); }
.bt-lang { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.bt-lang button[aria-pressed="true"] { border-color: var(--color-primary); background: var(--color-primary-light); color: var(--color-primary-dark); font-weight: 700; }
.bt-table caption { caption-side: top; text-align: left; padding: 10px 10px 6px; font-size: 13px; font-weight: 700; color: var(--color-text-main); }
.bt-table tbody th[scope="row"] { text-align: left; white-space: nowrap; font-size: 12.5px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--color-primary); background: transparent; border-bottom: 1px solid var(--color-background); }
.bt-items { margin: 0; padding-left: 16px; }
.table-scroll[hidden] { display: none; }
