/* R16 project accounting & cost control – projects-billing.css. Owner: BL – billing, revenue recognition & project close. Every class in this file starts with "pb-". */

/* KPI cards that filter the list */
.pb-kpi { text-align: start; cursor: pointer; font: inherit; color: inherit; border: 1px solid var(--border); }
.pb-kpi.on { border-color: var(--primary); box-shadow: inset 0 -3px 0 var(--primary); }
.pb-kpi-warn .kpi-value { color: var(--amber-fg); }
.pb-kpi-bad .kpi-value { color: var(--red-fg); }
.pb-kpi-good .kpi-value { color: var(--green-fg); }
.pb-kpis { margin-block: 12px; }

/* two columns that stack on phones */
.pb-cols { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.pb-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.pb-pad { padding: 14px 16px 0; }

/* workflow steps of a bill */
.pb-steps { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0 0 12px; padding: 0; }
.pb-steps li { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: var(--gray-bg); color: var(--muted); font-size: 13px; }
.pb-steps li.done { background: var(--green-bg); color: var(--green-fg); }
.pb-steps li.now { background: var(--blue-bg); color: var(--blue-fg); font-weight: 600; }
.pb-steps li.bad { background: var(--red-bg); color: var(--red-fg); }

/* bill lines */
.pb-lines td { vertical-align: middle; }
.pb-lines input.pb-in { width: 100%; min-width: 72px; max-width: 120px; text-align: end; font-family: var(--mono); }
.pb-lines input.pb-in-wide { width: 100%; min-width: 160px; }
.pb-lines tr.pb-moved td { background: color-mix(in srgb, var(--blue-bg) 55%, transparent); }
.pb-lines tr.pb-over td { background: color-mix(in srgb, var(--amber-bg) 60%, transparent); }
.pb-lines tfoot td { font-weight: 600; border-top: 2px solid var(--border); }
.pb-ref { font-family: var(--mono); white-space: nowrap; }
.pb-sub { display: block; color: var(--muted); font-size: 12px; }
.pb-line-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--row-line); }

/* totals of a bill */
.pb-totals { display: grid; gap: 0; }
.pb-totals > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dotted var(--border); }
.pb-totals > div > span:last-child { font-family: var(--mono); text-align: end; }
.pb-totals .pb-less > span:first-child { padding-inline-start: 12px; color: var(--muted); }
.pb-totals .pb-net { border-bottom: none; border-top: 2px solid var(--text); font-weight: 700; font-size: 1.05rem; padding-top: 10px; }
.pb-totals .pb-net > span:last-child { color: var(--primary); }

/* meter (billed / complete) */
.pb-bar { position: relative; height: 8px; border-radius: 999px; background: var(--gray-bg); overflow: hidden; min-width: 60px; }
.pb-bar > span { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 999px; background: var(--series-1); }
.pb-bar.over > span { background: var(--amber-fg); }
.pb-meter { display: flex; flex-direction: column; gap: 4px; min-width: 90px; }

/* project picker cards in the new-bill dialog */
.pb-kinds { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-top: 8px; }
.pb-kind { display: flex; flex-direction: column; gap: 4px; text-align: start; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
           background: var(--surface); color: inherit; font: inherit; cursor: pointer; }
.pb-kind:hover:not(:disabled) { border-color: var(--primary); }
.pb-kind.on { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.pb-kind:disabled { opacity: .55; cursor: not-allowed; }
.pb-kind strong { display: flex; gap: 6px; align-items: center; }

/* timeline */
.pb-timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.pb-timeline li { position: relative; display: flex; gap: 12px; padding: 0 0 14px; }
.pb-timeline li::before { content: ""; position: absolute; inset-inline-start: 5px; inset-block: 14px 0; width: 2px; background: var(--row-line); }
.pb-timeline li:last-child::before { display: none; }
.pb-tl-dot { flex: none; width: 12px; height: 12px; margin-top: 4px; border-radius: 50%; background: var(--gray-fg); box-shadow: 0 0 0 3px var(--surface); position: relative; z-index: 1; }
.pb-tl-good .pb-tl-dot { background: var(--green-fg); }
.pb-tl-bad .pb-tl-dot { background: var(--red-fg); }
.pb-tl-info .pb-tl-dot { background: var(--blue-fg); }
.pb-tl-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.pb-tl-head { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }

/* banners & notes */
.pb-note { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--blue-bg); color: var(--blue-fg); font-size: 13px; margin: 0 0 12px; }
.pb-note.warn { background: var(--amber-bg); color: var(--amber-fg); }
.pb-note.bad { background: var(--red-bg); color: var(--red-fg); }
.pb-note.good { background: var(--green-bg); color: var(--green-fg); }
.pb-warns { display: flex; flex-wrap: wrap; gap: 4px; }
.pb-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: var(--amber-bg); color: var(--amber-fg); white-space: nowrap; }
.pb-chip.bad { background: var(--red-bg); color: var(--red-fg); }
.pb-chip.info { background: var(--blue-bg); color: var(--blue-fg); }

/* revenue sheet */
.pb-sheet th, .pb-sheet td { white-space: nowrap; }
.pb-sheet td.pb-proj { white-space: normal; min-width: 180px; }
.pb-sheet tr.pb-blocked td { color: var(--muted); }
.pb-sheet .pb-sel { width: 28px; }
.pb-period { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.pb-explain { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 24px; font-size: 13px; }
.pb-explain > div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dotted var(--border); padding: 3px 0; }
.pb-explain > div > span:last-child { font-family: var(--mono); }

/* close checklist */
.pb-checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pb-checks li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--row-line); }
.pb-checks li:last-child { border-bottom: none; }
.pb-check-ic { flex: none; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.pb-check-ok .pb-check-ic { background: var(--green-bg); color: var(--green-fg); }
.pb-check-warn .pb-check-ic { background: var(--amber-bg); color: var(--amber-fg); }
.pb-check-block .pb-check-ic { background: var(--red-bg); color: var(--red-fg); }
.pb-check-text { flex: 1; min-width: 0; }
.pb-check-ok .pb-check-text { color: var(--muted); }

/* printed certificate */
.pb-print h3 { display: flex; justify-content: space-between; gap: 12px; margin: 18px 0 8px; font-size: 14px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.pb-print table.grid { font-size: 12px; }
.pb-print .pb-sign { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-top: 36px; }
.pb-print .pb-sign > div { border-top: 1px solid var(--text); padding-top: 6px; font-size: 12px; text-align: center; }

@media (max-width: 960px) {
  .pb-cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .pb-explain { grid-template-columns: minmax(0, 1fr); }
  .pb-print .pb-sign { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .pb-lines input.pb-in { min-width: 64px; }
}
@media print {
  .pb-print .pb-sign { break-inside: avoid; }
  .pb-lines tr.pb-moved td { background: none; }
}
