/* css/thanhtoan.css — Đ5-2 · thẻ "Hồ sơ thanh toán" (#/tt), js/ui-thanhtoan.js. Nạp sau app.css; chỉ lớp tiền tố tt-.
   Dùng biến theme (navy, đỏ, luxe): --primary, --danger, --success, --warn, --bd, --ink, --ink-2, --ink-3, --rad-sm, --rad-md.
   Máy tính: cột theo bước 1 đến 11 (cuộn ngang). Điện thoại (bề rộng tối đa 640px): danh sách nhóm theo bước, vòng chi gộp một nhóm. */

.tt { color: var(--ink, #17232f); }
.tt-dau { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 12px; }
.tt-tieude { margin: 0; font-size: var(--fs-xl, 20px); }
.tt-dau-nut { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.tt-quaylai { white-space: nowrap; }
.tt-nut-chinh { background: var(--primary, #1F4E79); color: var(--primary-ink, #fff); border: 1px solid var(--primary, #1F4E79); border-radius: var(--rad-sm, 9px); padding: 6px 14px; cursor: pointer; font-weight: 600; }
.tt-nut-chinh:disabled, .tt-nut-nguy:disabled { opacity: .55; cursor: not-allowed; }
.tt-nut-nguy { background: #fff; color: var(--danger, #C0392B); border: 1px solid var(--danger, #C0392B); border-radius: var(--rad-sm, 9px); padding: 6px 14px; cursor: pointer; font-weight: 600; }
.tt-nho { padding: 2px 8px; font-size: var(--fs-xs, 12px); }
.tt-phu { color: var(--ink-3, #6b7a88); font-size: var(--fs-sm, 13px); }
.tt-trong, .tt-loi { padding: 18px; border: 1px dashed var(--bd, #ddd); border-radius: var(--rad-md, 13px); background: #fff; }
.tt-loi { border-color: var(--danger, #C0392B); color: var(--danger, #C0392B); }
.tt-canhbao { margin: 8px 0; padding: 8px 12px; border-left: 4px solid var(--danger, #C0392B); background: color-mix(in srgb, var(--danger, #C0392B) 8%, #fff); color: var(--ink, #17232f); border-radius: 6px; }

/* Dải số theo trạng thái + đợt chi kế tiếp */
.tt-dai { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 10px; padding: 8px 12px; background: var(--ds-surface-2, #f4f6f9); border-radius: var(--rad-sm, 9px); }
.tt-so { font-size: var(--fs-sm, 13px); color: var(--ink-2, #3b4a58); }
.tt-so-dot { margin-left: auto; }

/* Lọc */
.tt-loc { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 12px; }
.tt-loc-nut { border: 1px solid var(--bd, #ddd); background: #fff; color: var(--ink-2, #3b4a58); border-radius: var(--rad-pill, 999px); padding: 4px 12px; cursor: pointer; font-size: var(--fs-sm, 13px); }
.tt-loc-nut.on { background: var(--primary, #1F4E79); border-color: var(--primary, #1F4E79); color: var(--primary-ink, #fff); }
.tt-loc-da { font-size: var(--fs-sm, 13px); margin-left: 6px; }
/* ND-2d: ô lọc «Theo dự án» là ô danh mục chung (kiểu của css/danhmuc.css); khung chỉ xếp nhãn + ô, co theo bề rộng */
div.tt-loc-da { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; min-width: 0; max-width: 100%; }
.tt-loc-da-nhan { color: var(--ink-2, #3b4a58); }

/* Chip */
.tt-chip { display: inline-block; padding: 1px 8px; border-radius: var(--rad-pill, 999px); font-size: var(--fs-xs, 12px); line-height: 18px; border: 1px solid var(--bd, #ddd); background: #fff; color: var(--ink-2, #3b4a58); margin: 2px 4px 2px 0; }
.tt-chip-do { border-color: var(--danger, #C0392B); color: var(--danger, #C0392B); background: color-mix(in srgb, var(--danger, #C0392B) 7%, #fff); }
.tt-chip-cam { border-color: var(--warn, #E0A100); color: #8a5a00; background: color-mix(in srgb, var(--warn, #E0A100) 12%, #fff); }
.tt-chip-xam { color: var(--ink-3, #6b7a88); background: var(--grey, #f4f4f4); }
.tt-chip-tt { border-color: var(--primary, #1F4E79); color: var(--primary, #1F4E79); font-size: var(--fs-sm, 13px); }
.tt-chip-bo { cursor: pointer; }

/* Màn chính: bảng cột theo bước (máy tính) */
.tt-bang { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.tt-cot { flex: 0 0 250px; background: var(--ds-surface-2, #f4f6f9); border-radius: var(--rad-md, 13px); padding: 8px; }
.tt-cot-ten { margin: 2px 4px 8px; font-size: var(--fs-sm, 13px); color: var(--ink-2, #3b4a58); font-weight: 600; }
.tt-dem { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: var(--rad-pill, 999px); background: #fff; border: 1px solid var(--bd, #ddd); text-align: center; font-weight: 600; }
.tt-ds-dt { display: none; }
.tt-the { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; background: #fff; border: 1px solid var(--bd, #ddd); border-left: 4px solid var(--primary, #1F4E79); border-radius: var(--rad-sm, 9px); padding: 8px 10px; margin: 0 0 8px; cursor: pointer; font: inherit; color: inherit; box-shadow: var(--ds-shadow, none); }
.tt-the:hover, .tt-the:focus-visible, .tt-the:focus-within { box-shadow: var(--ds-shadow-lift, 0 4px 16px rgba(16,35,47,.10)); }
.tt-the-qh { border-left-color: var(--danger, #C0392B); }
/* ND-2d: thẻ là khối (chứa liên kết dự án), mã hồ sơ là nút bàn phím trông như chữ */
.tt-the-ma { align-self: flex-start; max-width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 700; font-size: var(--fs-sm, 13px); text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.tt-the-ma:focus-visible { outline: 2px solid var(--primary, #1F4E79); outline-offset: 2px; border-radius: 4px; }
.tt-the-dong { font-size: var(--fs-sm, 13px); color: var(--ink-2, #3b4a58); overflow-wrap: anywhere; min-width: 0; }
.tt-the-tien { font-weight: 600; font-variant-numeric: tabular-nums; }
.tt-the-phu { font-size: var(--fs-xs, 12px); color: var(--ink-3, #6b7a88); }

/* Chi tiết */
.tt-tientrinh { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 4px; list-style: none; margin: 0 0 6px; padding: 0; counter-reset: none; }
.tt-b { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; font-size: var(--fs-xs, 12px); color: var(--ink-2, #3b4a58); }
.tt-b-so { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; border: 2px solid var(--bd, #ddd); background: #fff; }
.tt-b-ten { line-height: 1.25; }
.tt-b-xong .tt-b-so, .tt-o-mau.tt-b-xong { background: var(--success, #2E7D32); border-color: var(--success, #2E7D32); color: #fff; }
.tt-b-dang .tt-b-so, .tt-o-mau.tt-b-dang { background: var(--warn, #E0A100); border-color: var(--warn, #E0A100); color: #fff; }
.tt-b-do .tt-b-so, .tt-o-mau.tt-b-do { background: var(--danger, #C0392B); border-color: var(--danger, #C0392B); color: #fff; }
.tt-b-cho .tt-b-so, .tt-o-mau.tt-b-cho { background: var(--grey, #f4f4f4); color: var(--ink-3, #6b7a88); }
.tt-b-bo .tt-b-so, .tt-o-mau.tt-b-bo { background: repeating-linear-gradient(45deg, #fff 0 4px, var(--bd, #ddd) 4px 7px); color: var(--ink-3, #6b7a88); }
.tt-b-bo .tt-b-ten { text-decoration: line-through; color: var(--ink-3, #6b7a88); }
.tt-o-mau { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1px solid var(--bd, #ddd); vertical-align: -2px; margin: 0 2px 0 8px; }
.tt-chuthich { margin: 0 0 12px; }
.tt-vungnut { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; padding: 10px 12px; border: 1px solid var(--bd, #ddd); border-radius: var(--rad-md, 13px); background: #fff; }
.tt-luoi { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.tt-khoi { background: #fff; border: 1px solid var(--bd, #ddd); border-radius: var(--rad-md, 13px); padding: 10px 14px; margin: 0 0 12px; }
.tt-khoi h3 { margin: 0 0 8px; font-size: var(--fs-lg, 16px); }
.tt-dong { display: flex; gap: 10px; padding: 4px 0; border-bottom: 1px dotted var(--bd, #ddd); font-size: var(--fs-md, 14px); }
.tt-dong:last-child { border-bottom: 0; }
.tt-nhan { flex: 0 0 38%; color: var(--ink-3, #6b7a88); }
.tt-gt { flex: 1 1 auto; overflow-wrap: anywhere; }
.tt-tep-ds { list-style: none; margin: 0; padding: 0; }
.tt-tep-ds li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 1px dotted var(--bd, #ddd); }
.tt-tep-ds .tt-nhan { flex: 0 0 210px; }
.tt-tep-mot { display: inline-flex; align-items: center; gap: 4px; margin-right: 8px; }
.tt-tai { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tt-dtg-ds { margin: 0; padding-left: 20px; }
.tt-dtg-ds li { margin: 0 0 6px; font-size: var(--fs-sm, 13px); }
.tt-dtg-luc { color: var(--ink-3, #6b7a88); font-variant-numeric: tabular-nums; }
.tt-dtg-suyra { font-style: italic; }

/* Hộp thoại và biểu mẫu */
.tt-hop { min-width: min(520px, 92vw); }
.tt-hop h3 { margin: 0 0 10px; }
.tt-hop-nut { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.tt-o { display: flex; flex-direction: column; gap: 4px; margin: 0 0 10px; font-size: var(--fs-sm, 13px); color: var(--ink-2, #3b4a58); }
.tt-o input, .tt-o textarea, .tt-o select { font: inherit; font-size: var(--fs-md, 14px); padding: 6px 8px; border: 1px solid var(--bd, #ddd); border-radius: 6px; color: var(--ink, #17232f); }
.tt-xemtien { margin: -6px 0 10px; }
/* ND-2d: ô danh mục chung trong biểu mẫu (nhãn hiện + ô; ô tự co theo khung, không tràn 390px) */
.tt-o-dm { min-width: 0; max-width: 100%; }
.tt-o-nhan { color: var(--ink-2, #3b4a58); }
.tt-chuaban { margin: 2px 0 10px; padding: 6px 10px; border-left: 4px solid var(--warn, #E0A100); background: color-mix(in srgb, var(--warn, #E0A100) 10%, #fff); color: var(--ink, #17232f); font-size: var(--fs-sm, 13px); border-radius: 0 var(--rad-sm, 9px) var(--rad-sm, 9px) 0; overflow-wrap: anywhere; }
.tt-ch-da { margin: 8px 0 0; padding: 8px 0 0; border-top: 1px dotted var(--bd, #ddd); }
.tt-thieu, .tt-mst { border: 1px solid var(--bd, #ddd); border-radius: var(--rad-sm, 9px); padding: 6px 12px 10px; margin: 0 0 10px; }
.tt-thieu label { display: inline-flex; align-items: center; gap: 4px; margin: 2px 12px 2px 0; font-size: var(--fs-sm, 13px); }
.tt-chon { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; cursor: pointer; }
.tt-khoa { color: var(--ink-3, #6b7a88); cursor: default; }
.tt-hd { border-bottom: 1px dotted var(--bd, #ddd); }
.tt-lap-buoc { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0 0 12px; padding: 0; }
.tt-lap-buoc li { padding: 3px 10px; border-radius: var(--rad-pill, 999px); border: 1px solid var(--bd, #ddd); font-size: var(--fs-xs, 12px); color: var(--ink-3, #6b7a88); background: #fff; }
.tt-lap-buoc li.on { border-color: var(--primary, #1F4E79); color: var(--primary, #1F4E79); font-weight: 700; }
.tt-lap-buoc li.xong { color: var(--success, #2E7D32); border-color: var(--success, #2E7D32); }
.tt-han { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 12px; }

/* Danh sách chi của đợt */
.tt-dot-chon { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.tt-bangchi { width: 100%; border-collapse: collapse; font-size: var(--fs-sm, 13px); background: #fff; }
.tt-bangchi th, .tt-bangchi td { padding: 6px 8px; border-bottom: 1px solid var(--bd, #ddd); text-align: left; vertical-align: top; }
.tt-bangchi th { background: var(--primary-soft, #eef3f8); }
.tt-so-cot { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Điện thoại: danh sách nhóm theo bước (vòng chi gộp một nhóm) */
@media (max-width: 640px) {
  .tt-bang { display: none; }
  .tt-ds-dt { display: block; }
  .tt-nhom { margin: 0 0 12px; }
  .tt-dau-nut { margin-left: 0; }
  .tt-so-dot { margin-left: 0; }
  .tt-tientrinh { grid-template-columns: repeat(6, minmax(0, 1fr)); row-gap: 8px; }
  .tt-b-ten { display: none; }
  .tt-nhan { flex-basis: 42%; }
  .tt-tep-ds .tt-nhan { flex-basis: 100%; }
  .tt-hop { min-width: 0; }
}

/* In tờ trình luân chuyển: chỉ phần chi tiết hồ sơ */
@media print {
  body.tt-dang-in * { visibility: hidden; }
  body.tt-dang-in .tt-ct, body.tt-dang-in .tt-ct * { visibility: visible; }
  body.tt-dang-in .tt-ct { position: absolute; left: 0; top: 0; width: 100%; }
  body.tt-dang-in .tt-khong-in, body.tt-dang-in .tt-quaylai { display: none; }
  body.tt-dang-in .tt-b-ten { display: block; }
}
