/* HQ-53b: Chốt tháng CTV (views/ctv_close.js, #/ctv-close). Tiền tố cc-. Chỉ dùng biến màu của app.css (sáng / tối).
   Ngăn chi tiết dùng lại khung .ctv-drawer của ctv.css; ô số .ex-card của expenses.css. */
.cc-steps { list-style: none; counter-reset: cc; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: -6px 0 14px; padding: 0; }
.cc-steps li { counter-increment: cc; display: grid; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px 9px 40px; position: relative; font-size: 13px; }
.cc-steps li::before { content: counter(cc); position: absolute; left: 11px; top: 9px; width: 21px; height: 21px; border-radius: 50%; background: var(--brand-soft);
  color: var(--brand-dark); font-weight: 700; font-size: 12px; display: grid; place-items: center; }
.cc-steps li span { color: var(--muted); }
.msg.cc-mailoff { background: var(--warn-soft); color: var(--warn); }
.cc-filters .cc-search input { min-width: 240px; }

/* Ô số */
.cc-tiles .cc-tile-warn .ex-val { color: var(--warn); }
.cc-tiles .cc-tile-ok .ex-val, .cc-dmoney .cc-tile-ok .ex-val { color: var(--ok-text); }
.cc-tiles .cc-tile-info .ex-val { color: var(--accent-text); }

/* Khối CTV chưa chốt + nút "Chốt tháng" */
.cc-pending { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; padding: 12px 16px; margin: 0 0 12px;
  border-left: 4px solid var(--brand); }
.cc-pending-text { flex: 1 1 320px; min-width: 0; }

/* Chip trạng thái theo tone server trả: ok | info | warn | err | muted */
.cc-chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.cc-chip a { color: inherit; }
.cc-chip.t-ok { background: var(--ok-soft); color: var(--ok-text); }
.cc-chip.t-info { background: var(--brand-soft); color: var(--brand-dark); }
.cc-chip.t-warn { background: var(--warn-soft); color: var(--warn); }
.cc-chip.t-err { background: var(--err-soft); color: var(--err); }
.cc-wait { font-size: 12px; color: var(--muted); white-space: nowrap; }
.cc-wait.long { color: var(--warn); font-weight: 600; }
.cc-chips-cell { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.cc-flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.cc-flags .badge a { color: inherit; text-decoration: underline; }
.cc-nomail { color: var(--err); font-weight: 600; }
.cc-mail { overflow-wrap: anywhere; }
.cc-quote { font-size: 12px; margin-top: 4px; padding: 4px 8px; border-radius: 8px; background: var(--surface-2); max-width: 280px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.cc-quote.t-err { background: var(--err-soft); }
.cc-dates-cell { font-size: 12.5px; white-space: nowrap; }
.cc-bulk { margin: 0 0 10px; }
.cc-foot-note { margin: 8px 0 14px; }

/* Bảng hồ sơ */
table.cc-table td { vertical-align: top; }
table.cc-table td.num { white-space: nowrap; }
.cc-pick { width: 28px; }
table.cc-table td.cc-col-ctv { min-width: 170px; }
table.cc-table td.cc-col-st { min-width: 160px; }
table.cc-table .cc-chips-cell .cc-chip { white-space: normal; }
.cc-flags .badge { white-space: normal; }
.cc-acts { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; min-width: 130px; max-width: 300px; margin-left: auto; }
.cc-more-btn { display: none; }

/* Hộp chốt tháng / xem trước */
.cc-lead { margin-top: 0; }
.cc-date-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.cc-date-note { margin: -4px 0 10px; }
.cc-pv-sum { margin: 6px 0 8px; }
table.cc-pv td { vertical-align: top; }
table.cc-pv td.num { white-space: nowrap; }
table.cc-pv tfoot td { font-weight: 600; border-top: 2px solid var(--line); }
.cc-pv-note { max-width: 200px; white-space: normal; }
.cc-pv-flag { color: var(--warn); margin: 8px 0; }
.cc-skip { margin: 8px 0; }
.cc-skip summary { cursor: pointer; color: var(--muted); }
.cc-names { margin: 6px 0; padding-left: 20px; max-height: 40vh; overflow: auto; }
.cc-link-row { display: flex; gap: 6px; margin: 0 0 10px; }
.cc-link-row input { flex: 1; min-width: 0; }

/* Chân trang: xuất thuế TNCN năm */
.cc-pit { padding: 12px 16px; margin: 6px 0 0; }
.cc-pit h3 { margin: 0 0 2px; font-size: 15px; }
.cc-pit .filters { margin: 8px 0 0; }

/* Ngăn chi tiết */
.cc-dmoney { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cc-dinfo { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; font-size: 13px; margin: 6px 0; }
.cc-dinfo .muted { margin-right: 4px; }
.cc-dacts { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.cc-drawer h4 { margin: 16px 0 6px; }
.cc-pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.cc-reply { background: var(--surface-2); border-radius: 10px; padding: 8px 12px; margin: 0 0 10px; max-height: 260px; overflow: auto; }
.cc-reply.t-err { background: var(--err-soft); }
.cc-docs { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.cc-docs li { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.cc-doc-btns { display: flex; gap: 6px; }
.cc-ev { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 4px 12px; font-size: 13px; margin: 0; }
.cc-ev dt { color: var(--muted); }
.cc-ev dd { margin: 0; overflow-wrap: anywhere; }
.cc-ev-sub { margin: 0; padding-left: 16px; }
.cc-statement { margin: 12px 0 0; }
.cc-statement summary { cursor: pointer; font-weight: 600; }
.cc-tl { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); display: grid; gap: 8px; font-size: 13px; }
.cc-tl li { position: relative; }
.cc-tl li::before { content: ""; position: absolute; left: -20px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }
.cc-tl-at { display: block; font-size: 11.5px; color: var(--muted); }

/* Bảng chọn "⋯" dưới đáy màn hình (màn hẹp) */
.cc-sheet-bg { position: fixed; inset: 0; background: var(--overlay); z-index: 55; display: flex; align-items: flex-end; justify-content: center; }
.cc-sheet { width: 100%; max-width: 520px; background: var(--surface); border-radius: 16px 16px 0 0; padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
  display: grid; gap: 6px; box-shadow: 0 -12px 40px rgb(0 0 0 / .25); }
.cc-sheet-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.cc-sheet-head .x { margin-left: auto; border: 0; background: none; font-size: 22px; color: var(--muted); cursor: pointer; line-height: 1; }
.cc-sheet .btn { justify-content: center; min-height: 44px; }

@media (max-width: 1100px) {
  .cc-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .cc-steps { grid-template-columns: 1fr; }
  .cc-filters > label, .cc-filters .cc-search input { flex: 1 1 100%; min-width: 0; }
  .cc-filters input, .cc-filters select { min-width: 0; width: 100%; }
  .cc-pending .btn { width: 100%; }
  .cc-bulk { flex-direction: column; align-items: stretch; }
  .cc-date-row, .cc-dinfo { grid-template-columns: 1fr; }
  .cc-dmoney { grid-template-columns: 1fr 1fr; }
  /* bảng hồ sơ thành thẻ: mỗi dòng một thẻ, nhãn cột hiện trên từng ô */
  table.data.cc-table, table.data.cc-table tbody, table.data.cc-table tr, table.data.cc-table td { display: block; width: 100%; }
  table.data.cc-table thead { display: none; }
  table.data.cc-table tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  table.data.cc-table td { border: 0; padding: 3px 0; text-align: left; }
  table.data.cc-table td.num { white-space: normal; }
  table.data.cc-table td.cc-col-ctv, table.data.cc-table td.cc-col-st { min-width: 0; }
  table.data.cc-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.cc-table td.cc-pick { float: right; width: auto; }
  .cc-quote { max-width: none; display: block; }
  .cc-acts { justify-content: flex-start; min-width: 0; margin-top: 4px; }
  .cc-acts .cc-sec { display: none; }
  .cc-more-btn { display: inline-flex; font-size: 16px; line-height: 1; }
  .cc-acts .btn { min-height: 36px; }
}

/* HQ-61: chốt hết việc trước khi gửi — việc chưa chốt, phát sinh sau xác nhận, văn bản lập riêng, câu thuế CTV thấy */
.cc-open { margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-size: 13px; }
.cc-open strong { color: inherit; }
.cc-open-list { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.cc-open-list li { margin: 3px 0; overflow-wrap: anywhere; }
.cc-open-list .btn { margin-left: 4px; }
.cc-held-note { color: var(--warn); margin: 0 0 8px; }
.cc-late, .cc-sep { padding: 12px 16px; margin: 0 0 12px; }
.cc-late h3, .cc-sep h3 { margin: 0 0 4px; font-size: 15px; }
.cc-late-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px 16px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--line); }
.cc-late-row > div { flex: 1 1 280px; min-width: 0; }
.cc-sep-list { margin: 6px 0 0; padding-left: 18px; }
.cc-sep-list li { margin: 4px 0; overflow-wrap: anywhere; }
.cc-tax { margin: 8px 0 4px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); font-size: 13.5px; }
.cc-quote.t-warn { background: var(--warn-soft); }
.cc-open, .cc-open-list li, .cc-late-row, .cc-sep-list li { white-space: normal; overflow-wrap: anywhere; }
td .cc-open { max-width: 360px; }
@media (max-width: 760px) { td .cc-open { max-width: none; } }
