/* M05 Tài chính, the new screens (design "Ứng dụng CDLAF – Thiết kế theo 9 module", frame "ThanhToan"). They show only when
   CDLAF_FEATURES.ui('m05') is on (module menu and ui_finance), drawn under .m05 by payments.js: off, nothing here applies
   and the old screens keep their look. */
.m05 { display: grid; gap: 16px; }

/* three totals: issued not paid, overdue, paid (by currency) */
.m05 .m5-sums { display: flex; flex-wrap: wrap; gap: 12px; }
.m05 .m5-sum { flex: 1 1 200px; min-width: 0; display: grid; gap: 2px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.m05 .m5-sum span { font-size: 12px; color: var(--muted); }
.m05 .m5-sum b { font-size: 20px; line-height: 1.25; overflow-wrap: anywhere; }
.m05 .m5-sum.m5-warn b { color: var(--warn); }
.m05 .m5-sum.m5-bad b { color: var(--danger, #b42318); }
.m05 .m5-sum.m5-ok b { color: var(--ok); }

/* the cases on the left, the chosen one on the right */
.m05 .m5-cols { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(0, 2.8fr); gap: 16px; align-items: start; }
.m05 .m5-list { min-width: 0; }
.m05 .m5-h { margin: 0 0 8px; font-size: 14px; font-weight: 700; }
.m05 h3.m5-h { margin: 6px 0 0; }
.m05 .m5-sub { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.m05 .m5-row { cursor: pointer; }
.m05 .m5-row:hover td { background: var(--sunken); }
.m05 .m5-row.on td { background: var(--accent-soft); }
.m05 .m5-row.on td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.m05 .m5-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.m05 .m5-note { display: block; margin-top: 2px; font-size: 12px; font-weight: 700; }
.m05 .m5-note.m5-bad { color: var(--danger, #b42318); }
.m05 .m5-note.m5-warn { color: var(--warn); }
.m05 .m5-note.m5-ok { color: var(--ok); }
.m05 .m5-note.m5-muted { color: var(--muted); }

.m05 .m5-detail { min-width: 0; display: grid; gap: 12px; align-content: start; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 20px; }
.m05 .m5-detail > .module { border: 0; padding: 0; }
.m05 .m5-dhead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 10px; }
.m05 .m5-dhead h2 { margin: 0; font-size: 18px; }
.m05 .m5-dsub, .m05 .m5-meta { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.m05 .m5-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.m05 .m5-back { display: none; justify-self: start; }
.m05 .m5-empty { margin: 0; }
.m05 .m5-foot { margin: 0; font-size: 12px; }
.m05 .num { text-align: right; white-space: nowrap; }

/* buttons on the lines */
.m05 .btn-sm { padding: 4px 10px; font-size: 12.5px; min-height: 32px; }
.m05 .btn-primary { width: auto; padding: 6px 12px; font-size: 13px; }
.m05 .btn:disabled { opacity: .55; cursor: not-allowed; }
.m05 .m5-do { min-width: 140px; }
.m05 .m5-btns { display: flex; flex-wrap: wrap; gap: 4px; align-items: flex-start; }
/* the shared tables (.ic-mtable) are at least 720px wide, their second column 220px: these tables fit their column */
.m05 .ic-mtable { min-width: 0; }
.m05 .ic-mtable th:nth-child(2) { min-width: 0; }
.m05 .m5-inst th:nth-child(2) { min-width: 140px; }
.m05 .m5-menu { display: inline-block; }
.m05 .m5-menu > summary { list-style: none; }
.m05 .m5-menu > summary::-webkit-details-marker { display: none; }
.m05 .m5-menu[open] > summary { border-color: var(--accent); color: var(--accent); }
.m05 .m5-menu-list { display: flex; gap: 10px; padding: 6px 2px 0; }

/* a question asked on the page */
.m05 .m5-ask { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent-soft); }
.m05 .m5-ask[hidden] { display: none; }
.m05 .m5-ask p { margin: 0; }
.m05 .m5-ask .row { display: flex; flex-wrap: wrap; gap: 8px; }
.m05 .m5-ask .btn-danger { background: var(--danger, #b42318); border-color: var(--danger, #b42318); color: #fff; }
.m05 .m5-askdate { display: grid; gap: 4px; max-width: 220px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.m05 .m5-askdate input { font: inherit; font-weight: 400; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }

/* narrower: one column; a chosen case takes the page, "← Danh sách hồ sơ" goes back */
@media (max-width: 1100px) {
  .m05 .m5-cols { grid-template-columns: minmax(0, 1fr); }
  .m05.has-sel .m5-list { display: none; }
  .m05 .m5-back { display: inline; }
}
@media (max-width: 760px) {
  .m05 .m5-detail { padding: 14px; }
  .m05 .num { text-align: left; }
  .m05 .m5-sum b { font-size: 18px; }
}

/* a period's fee, corrected in the request while it is a draft */
.m05 .pm-amt { text-align: right; min-width: 120px; }
.m05 .m5-nw { white-space: nowrap; }
