/* NEW-216: màn Nghiệm thu (views/acceptance_lines.js) — tiền tố nt-; chỉ biến màu của app.css (sáng / tối), không màu cứng.
   Bảng rộng cuộn ngang TRONG khung (.table-wrap), cột "Tháng" dính trái; ≤ 760 px mỗi dòng thành thẻ (như màn Tài chính) — trang không cuộn ngang. */
/* control panel NEW-71: màn không có ô tìm / bộ lọc gập (lọc ở .nt-filters) ⇒ bố cục 2 cột (không cắt tên màn ở 1280) — cả hai chế độ (NEW-240);
   NEW-248: bỏ đoạn giới thiệu ⇒ nhận màn bằng lớp .nt-head của tiêu đề (trước là :has(+ .nt-intro)) */
.main > .page-head.cp.nt-head { grid-template-columns: minmax(0, 1fr) auto; }
.main > .page-head.cp.nt-head > .cp-c { grid-column: 1 / -1; grid-row: 2; }
.main > .page-head.cp.nt-head > .cp-r { grid-column: 2; grid-row: 1; }

/* ---- ô lọc ---- */
.nt-filters { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: flex-end; margin: 0 0 10px; }
.nt-f { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); min-width: 0; }
.nt-f select { max-width: 220px; }
.nt-q { flex: 1 1 260px; }
.nt-q input { width: 100%; }
.nt-m input { width: 150px; }
.nt-seg { display: inline-flex; flex-wrap: wrap; gap: 4px; align-self: flex-end; }
.nt-seg .chip { min-height: 34px; }
.nt-pins { display: flex; flex-wrap: wrap; gap: 6px; }
.nt-pin { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border: 1px solid var(--brand); border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-dark); font-size: 13px; }
.nt-pin-x { border: 0; background: none; color: inherit; font: inherit; font-size: 16px; line-height: 1; cursor: pointer; min-width: 28px; min-height: 28px; border-radius: 999px; }
.nt-pin-x:hover { background: var(--hover); }
.nt-pin-x:focus-visible { outline: 2px solid var(--brand); outline-offset: 0; }
.nt-ferr { flex: 1 1 100%; margin: 0; }
/* NEW-240: chọn chế độ xem "Theo dòng | Theo hạng mục" (cùng kiểu nút Cách xem của Công nợ) + dòng gợi ý; chế độ Theo hạng mục dùng CSS rvp- của revenue_plan.css */
.nt-modebar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 0 0 12px; }
.nt-mode { display: inline-flex; gap: 4px; }
.nt-mode .btn { min-height: 36px; }
.nt-mode .btn[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }   /* chế độ đang xem — như .chip.on */
.nt-modehint { margin: 0; flex: 1 1 320px; min-width: 0; }
.nt-modebar + .msg { margin-bottom: 10px; }
.nt-sum { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.nt-sum strong { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---- bảng ---- */
.nt-table > tbody > tr > td, .nt-table > tfoot > tr > td { vertical-align: top; }
.nt-table td.num, .nt-table th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.nt-table td.num { min-width: 132px; }
/* bảng: số gồm VAT không ngắt giữa các nhóm nghìn (Sales.vatMoney chèn <wbr> cho ô KPI hẹp) — chỉ dòng phụ được xuống dòng */
.nt-table td.num .vm-g { white-space: nowrap; }
.nt-table td.num .vm-g wbr { display: none; }
.nt-table td.num .vm-p { overflow-wrap: normal; }
.nt-table td.num .vm-p, .nt-table td.num > .nt-s { white-space: normal; max-width: 200px; margin-left: auto; }
.nt-table tr.nt-row { cursor: pointer; }
.nt-table tr.nt-row:hover > td { background: var(--surface-2); }
.nt-table tr.nt-row:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.nt-s { font-size: 12px; margin-top: 2px; }
.nt-s.muted { color: var(--muted); }
.nt-code { font-weight: 600; color: var(--brand-dark); text-decoration: none; overflow-wrap: anywhere; }
.nt-code:hover, .nt-code:focus-visible { text-decoration: underline; }
.nt-proj { color: var(--ink); }
.nt-only { border: 0; background: none; padding: 0; font: inherit; font-size: 12px; color: var(--muted); cursor: pointer; text-decoration: underline;
  text-decoration-color: var(--btn-border); text-underline-offset: 2px; }
.nt-only:hover, .nt-only:focus-visible { color: var(--brand-dark); }
.nt-only:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 2px; }
.nt-table td.nt-ctr { min-width: 200px; max-width: 280px; }
.nt-table td.nt-client { min-width: 150px; max-width: 240px; overflow-wrap: anywhere; }
.nt-table td.nt-itemcol { min-width: 180px; max-width: 320px; }
.nt-item { font-weight: 500; overflow-wrap: anywhere; }
.nt-rv { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
/* cột "Tháng" dính trái khi bảng cuộn ngang — nền đặc để chữ cột khác không lộ qua */
.nt-table th.nt-month, .nt-table td.nt-month { position: sticky; left: 0; background: var(--surface); box-shadow: 1px 0 0 var(--line); min-width: 112px; white-space: nowrap; }
.nt-table th.nt-month { z-index: 3; background: var(--surface-2); }
.nt-table td.nt-month { z-index: 1; }
.nt-table tr.nt-row:hover > td.nt-month { background: var(--surface-2); }
.nt-total > td { font-weight: 600; background: var(--surface-2); border-top: 2px solid var(--line); }
.nt-table tr.nt-total > td.nt-month { background: var(--surface-2); }
/* vòng 2: ô Tháng là link Xem nhanh (peek.js) — chữ như ô thường, gạch chân khi rê / focus */
.nt-open { color: var(--ink); text-decoration: none; }
.nt-open:hover, .nt-open:focus-visible { color: var(--brand-dark); text-decoration: underline; }
.nt-table tr.peek-on > td.nt-month, .nt-table tr.peek-on:hover > td.nt-month { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand), 1px 0 0 var(--line); }
/* cột người (chỉ admin + quản lý — máy chủ trả people_cols): bảng rộng = cột BD / Account; ô gộp "BD · Account · Vận hành" chỉ cho thẻ điện thoại */
.nt-table .nt-ppc { display: none; }
.nt-table td.nt-pp { min-width: 130px; max-width: 200px; overflow-wrap: anywhere; }
/* Xem nhanh: một ô = một khối (dd của peek.css là flex) */
.nt-qv { display: block; min-width: 0; }
.nt-qv-sub { display: block; }
/* NEW-238 (chủ dự án 15/11): chế độ theo Mục — cột Kỳ (tháng + tuần hai dòng), BBNT nhãn nhỏ, ⋯ thao tác */
.nt-table td.nt-month .al-ky { font-weight: 600; }
.nt-table td.nt-month .al-ky-w { font-weight: 400; }
.nt-table td.nt-bb { min-width: 96px; max-width: 160px; }
.nt-table :is(th, td).nt-act { width: 1%; white-space: nowrap; text-align: right; }
.nt-table td.nt-act .api-menu { display: inline-block; }
.nt-foot { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; margin-top: 8px; }
.nt-empty { max-width: 640px; }

@media (max-width: 760px) {
  .nt-mode { display: flex; width: 100%; }
  .nt-mode .btn { flex: 1 1 0; min-height: 44px; }
  .nt-filters > .nt-f { flex: 1 1 calc(50% - 10px); }
  .nt-filters > .nt-q { flex-basis: 100%; }
  .nt-f select, .nt-f input, .nt-m input { width: 100%; max-width: none; font-size: 16px; }
  /* mỗi dòng một thẻ: nhãn cột phía trên từng ô, hai cột số cạnh nhau */
  table.data.nt-table, table.data.nt-table tbody, table.data.nt-table tfoot, table.data.nt-table tr, table.data.nt-table td { display: block; width: 100%; min-width: 0; max-width: none; }
  table.data.nt-table thead { display: none; }
  table.data.nt-table tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  table.data.nt-table tr.nt-row, table.data.nt-table tr.nt-total { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 12px; }
  table.data.nt-table td { border: 0; padding: 2px 0; text-align: left; white-space: normal; position: static; box-shadow: none; background: transparent; }
  table.data.nt-table td:empty { display: none; }
  table.data.nt-table td[data-label]:not([data-label=""])::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted);
    text-transform: uppercase; letter-spacing: .04em; }
  table.data.nt-table td.nt-ctr, table.data.nt-table td.nt-itemcol, table.data.nt-table td.nt-client { grid-column: 1 / -1; }
  table.data.nt-table td.num { text-align: left; }
  table.data.nt-table td.nt-act { text-align: right; }
  table.data.nt-table td.nt-bb { max-width: none; }
  /* NEW-219: ô đang sửa tại chỗ chiếm cả hàng của thẻ (ô nhập + ✓ ✕ + gợi ý không chen vào nửa thẻ), canh trái như thẻ */
  table.data.nt-table td:has(.rv-ie-box) { grid-column: 1 / -1; }
  .nt-table .rv-ie-box { min-width: 0; justify-content: flex-start; }
  .nt-table .rv-ie-hint, .nt-table .rv-ie-err { text-align: left; }
  .nt-table td.num .vm-p, .nt-table td.num > .nt-s { margin-left: 0; }
  .nt-table tr.nt-total > td { background: transparent; border-top: 0; }
  .nt-table tr.nt-total { background: var(--surface-2); }
  .nt-wrap { max-height: none !important; }
  /* thẻ của vai trò quản lý: một dòng người gộp thay ba ô BD / Account / Vận hành */
  table.data.nt-table.nt-people td.nt-ppd { display: none; }
  table.data.nt-table.nt-people td.nt-ppc { display: block; grid-column: 1 / -1; }
  table.data.nt-table tr.nt-total > td.nt-ppc { display: none; }
  table.data.nt-table tr.peek-on { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
  table.data.nt-table tbody tr.peek-on td, .nt-table tr.peek-on > td.nt-month { background: transparent; box-shadow: none; }
}
@media (pointer: coarse) {
  .nt-seg .chip, .nt-pin-x, .nt-mode .btn { min-height: 44px; }
  .nt-pin-x { min-width: 44px; }
  .nt-only { min-height: 44px; display: inline-flex; align-items: center; }
  .nt-open { display: inline-flex; align-items: center; min-height: 44px; }
}

/* NEW-216 vòng 3: khối "Giá vốn & Gross Profit (trước VAT)" trong Xem nhanh PHỤ LỤC (views/contracts.js gpBrief) — dùng chung file này
   (index.html nạp mọi CSS). Bảng 3 cột nhỏ, số canh phải, GP âm dùng token lỗi. */
.ct-gp-tw { margin: 0; }
.ct-gp { width: 100%; }
.ct-gp th[scope="row"] { font-weight: 400; text-align: left; }
.ct-gp td.num, .ct-gp th.num { white-space: nowrap; }
.ct-gp .ct-gp-neg { color: var(--err); }
.ct-gp .badge { margin-left: 6px; }
.ct-gp-s { font-size: 13px; margin: 8px 0 0; }
@media (max-width: 479.98px) {   /* điện thoại: bảng 3 cột vừa khung khu (390 px: 357 → ≤ 330 px), không phải cuộn ngang */
  table.data.ct-gp th, table.data.ct-gp td { padding-left: 6px; padding-right: 6px; font-size: 13px; }   /* thắng table.data th/td (0,1,2) */
  table.data.ct-gp thead th { font-size: 11px; }
  table.data.ct-gp tbody th[scope="row"] { white-space: normal; }
}

/* NEW-238 đợt 4 (D3) — FORM ĐẦY ĐỦ THEO MỤC (views/revenue.js openLineModal, tiền tố rvl-) — dùng chung file này (index.html nạp mọi CSS).
   Mỗi dòng theo Mục là một khối lưới (Mục · Số tiền + "gồm VAT" · VAT · % phí / Out Net · Dự kiến · Xoá, ghi chú + gợi ý dòng dưới); hộp rộng hơn
   hộp thường để dòng nằm một hàng ở laptop; ≤ 720 px gấp hai cột, < 360 px một cột. Chỉ token màu; phẳng; chỉ giao diện sáng (chủ dự án 13/11). */
.modal:has(.rvl) { max-width: 980px; }
.rvl { margin: 12px 0; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--zone-money, var(--surface-2));
  container: rvl / inline-size; }     /* bố cục theo bề rộng HỘP (không theo màn hình): hộp ~650 px ở màn 768 ⇒ 2 cột (rà soát tích hợp 15/11) */
.rvl-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0 0 8px; }
.rvl-h { margin: 0; font-size: 15px; }
.rvl-sub { font-size: 13px; }
.rvl-list { display: flex; flex-direction: column; gap: 8px; }
.rvl-row { display: grid; gap: 6px 10px; align-items: end; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  grid-template-columns: minmax(0, 1.5fr) minmax(10.5rem, 1.6fr) minmax(6.5rem, .9fr) minmax(0, 1.1fr) minmax(0, 1.2fr) auto;
  grid-template-areas: "cat amt vat ext fc del" "desc desc msg msg msg msg"; }
.rvl-row.rvl-new { border-style: dashed; }
.rvl-row.rvl-ro { background: var(--surface-2); }
.rvl-row.rvl-bad { border-color: var(--err); }
.rvl-row.rvl-gone { background: var(--surface-2); }
.rvl-row.rvl-gone .rvl-f { opacity: .55; }
.rvl-row.rvl-gone .rvl-name { text-decoration: line-through; }
.rvl-f { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rvl-f[hidden] { display: none; }
.rvl-fl { font-size: 12px; color: var(--muted); }
.rvl-v { min-width: 0; overflow-wrap: anywhere; }
.rvl-fro .rvl-v { min-height: 32px; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.rvl-cat { grid-area: cat; }
.rvl-cat .rvl-v { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.rvl-amt { grid-area: amt; }
.rvl-vat { grid-area: vat; }
.rvl-ext { grid-area: ext; }
.rvl-fc { grid-area: fc; }
.rvl-desc { grid-area: desc; }
.rvl-delw { grid-area: del; display: flex; align-items: flex-end; justify-content: flex-end; }
.rvl-msgs { grid-area: msg; min-width: 0; align-self: center; }
.rvl-msgs:empty { display: none; }
.rvl .rvl-in { width: 100%; min-width: 0; }
.rvl-num { text-align: right; font-variant-numeric: tabular-nums; }
.rvl-amt-in { display: flex; flex-direction: column; align-items: stretch; gap: 2px; min-width: 0; }   /* "gồm VAT" dưới ô — ô số đủ 9 chữ số */
.rvl-amt-in .rvl-in { flex: 1 1 auto; }
.rvl-sw { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink); white-space: nowrap; min-height: 32px; cursor: pointer; }
.rvl-sw input { margin: 0; }
.rvl-ext .rvl-sw { white-space: normal; }
.rvl-s { display: block; font-size: 12px; }
.rvl-hint { font-size: 12px; line-height: 1.4; }
.rvl-hint:empty { display: none; }
.rvl-err { font-size: 13px; color: var(--err); }
.rvl-why { margin: 0; font-size: 12px; }
.rvl-caps { margin-top: 6px; }
.rvl-acts { margin-top: 8px; }
.rvl-prev { margin-top: 8px; font-size: 13px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.rvl-prev:empty { display: none; }
.rvl-prev-h { font-weight: 600; }
.rvl-lock { margin: 0 0 8px; }
.rvl-reason { margin-top: 8px; }
.rvl-ferr { margin-top: 8px; }
.rvl-ferr .btn { margin-left: 6px; }
@media (max-width: 720px) {
  .rvl { padding: 10px; }
}
@container rvl (max-width: 759.98px) {
  .rvl-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "cat cat" "amt amt" "vat fc" "ext ext" "desc desc" "msg msg" "del del"; }
  .rvl-amt-in { flex-direction: row; align-items: center; gap: 6px; }       /* hai cột: ô Số tiền chiếm cả hàng ⇒ "gồm VAT" đứng cạnh */
}
@container rvl (max-width: 359.98px) {
  .rvl-row { grid-template-columns: minmax(0, 1fr); grid-template-areas: "cat" "amt" "vat" "fc" "ext" "desc" "msg" "del"; }
  .rvl-delw { justify-content: flex-start; }
}
@media (max-width: 768px), (pointer: coarse) {
  .rvl .rvl-in, .rvl .ss-btn { min-height: 44px; font-size: 16px; }
  .rvl .btn, .rvl-sw { min-height: 44px; }
}

/* NEW-238 đợt 4 (D5) — #/nghiem-thu chế độ THEO MỤC (cờ bật): mỗi hàng một dòng theo Mục (.nt-lines). Hàng Agency Fee chờ Ads Spend (.nt-pend) chỉ là
   chú thích xám; nhóm chưa tách (.nt-unsplit) nhãn "Chưa tách theo Mục". Dòng Tổng thứ hai = nhóm chưa tách (số kiểu cũ). */
.nt-table td.nt-mucol { min-width: 190px; max-width: 320px; overflow-wrap: anywhere; }
.nt-table td.nt-mucol .al-badges { margin-top: 2px; }
.nt-table td.nt-vat { white-space: nowrap; }
.nt-table tr.nt-pend > td { color: var(--muted); }
.nt-table tr.nt-pend .nt-item { font-weight: 400; }
.nt-table tr.nt-total-un > td { font-weight: 400; border-top: 1px solid var(--line); }
.nt-fcat select { max-width: 240px; }
/* review 15/11: bảng theo Mục gọn để 1280 (có sidebar) vẫn thấy tới cột Dự kiến — Phụ lục + Khách chung một ô, mã dòng dưới Mục, VAT xuống dòng */
.nt-table.nt-lines td.nt-ctr { min-width: 168px; max-width: 240px; }
.nt-table.nt-lines td.nt-mucol { min-width: 168px; max-width: 280px; }
.nt-table.nt-lines td.nt-vat { white-space: normal; min-width: 84px; max-width: 124px; }
.nt-table.nt-lines .nt-cl { overflow-wrap: anywhere; }
.nt-table.nt-lines td.nt-mucol .nt-rv { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  table.data.nt-table td.nt-mucol { grid-column: 1 / -1; }
  table.data.nt-table td.nt-vat { white-space: normal; }
  table.data.nt-table.nt-lines tr.nt-total-un { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 12px; background: var(--surface-2); }
}
@media (max-width: 760px) {
  .nt-table.nt-lines td.num .vm { align-items: flex-start; }
}
