/* Lingsaa Hub — billing screens (invoices, invoice form, customer card, dashboard money, Settings → Billing). Owned by the billing agent. */

/* Date boxes look like the other inputs (base.css lists only text-like inputs). */
input[type="date"] {
  min-height: 38px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  color-scheme: light dark;
}
label.field input[type="date"] { width: 100%; }
.filter-row input.date-input { width: auto; min-height: 34px; padding: 4px 8px; font-size: 13px; }

/* Invoice status pills */
.pill.inv-draft { background: var(--surface-3); color: var(--text-2); }
.pill.inv-issued { background: var(--warning-tint); color: var(--warning-ink); }
.pill.inv-part_paid { background: var(--accent-tint); color: var(--accent-ink); }
.pill.inv-paid { background: var(--good-tint); color: var(--good-ink); }
.pill.inv-cancelled { background: var(--surface-3); color: var(--muted); }
.inv-pills { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }

/* List */
.seg .btn.seg-late .seg-count { color: var(--critical-ink); font-weight: 700; }
.inv-dates { gap: 8px; }
.inv-cust-note { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 6px 10px; }
.inv-sums { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 22px; padding: 0 4px; font-size: 14px; }
.inv-sums b { font-variant-numeric: tabular-nums; }
.inv-table td { vertical-align: middle; }
.inv-row-cancelled td { color: var(--muted); }
.inv-row-cancelled td a.mono { text-decoration: line-through; }

/* One invoice */
.inv-label { font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 4px; }
.inv-parties > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.inv-dates-facts { padding-top: 12px; border-top: 1px solid var(--grid); }
.inv-lines td { vertical-align: top; }
.inv-totals { display: flex; flex-direction: column; gap: 4px; margin-left: auto; width: min(100%, 320px); font-variant-numeric: tabular-nums; }
.inv-total-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.inv-total-row b { font-weight: 600; }
.inv-total-row.grand { border-top: 1px solid var(--border-strong); padding-top: 6px; margin-top: 2px; font-size: 15px; }
.inv-total-row.grand b { font-weight: 750; }
.inv-total-row.balance b { color: var(--critical-ink); }
.inv-total-row.settled b { color: var(--good-ink); }
.inv-words { margin: 0; text-align: right; }
.inv-actions { display: flex; flex-direction: column; gap: 8px; }
.inv-actions .btn { justify-content: flex-start; }
.inv-sent, .inv-actions + .hint { margin: 10px 0 0; }
.inv-links { display: flex; flex-direction: column; gap: 16px; }
.inv-link-block { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.inv-link-block .hint { margin-top: 0; }
.inv-link-block .copy-box input { min-width: 0; font-size: 12px; min-height: 32px; padding: 4px 8px; }
.inv-link-block a .icon { width: 13px; height: 13px; }

/* Invoice form */
.inv-cust-box { display: flex; flex-direction: column; gap: 6px; }
.inv-cust-picked { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.inv-cust-results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.inv-cust-results:empty { display: none; }
.inv-cust-option {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left;
  padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; cursor: pointer;
}
.inv-cust-option:hover, .inv-cust-option:focus-visible { background: var(--surface-2); border-color: var(--border-strong); }

.inv-renew-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.inv-renew-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--grid); }
.inv-renew-list li:first-child { border-top: 0; }

.inv-edit-lines { display: flex; flex-direction: column; gap: 8px; }
.line-row {
  display: grid; gap: 8px; align-items: start;
  grid-template-columns: minmax(0, 1fr) 96px 68px 110px 78px 104px 32px;
  grid-template-areas: "desc sac qty price rate total rm";
}
.line-row:not(.line-head) + .line-row { padding-top: 8px; border-top: 1px solid var(--grid); }
.line-head { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.line-cell { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.line-cell input, .line-cell select { min-height: 36px; padding: 6px 9px; }
.c-desc { grid-area: desc; }
.c-sac { grid-area: sac; }
.c-qty { grid-area: qty; }
.c-price { grid-area: price; }
.c-rate { grid-area: rate; }
.c-total { grid-area: total; }
.c-rm { grid-area: rm; padding-top: 4px; }
.line-total { min-height: 36px; display: flex; align-items: center; justify-content: flex-end; font-variant-numeric: tabular-nums; }
.line-lab { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.inv-estimate { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; padding-top: 12px; border-top: 1px solid var(--grid); text-align: right; }
.inv-estimate p { margin: 0; max-width: 460px; }

/* Customer page card */
.bill-sums { display: flex; flex-wrap: wrap; gap: 12px 32px; }
.bill-sum { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.bill-renewals { padding-top: 10px; border-top: 1px solid var(--grid); }
.bill-renewals .inv-renew-list { margin-top: 4px; }

/* Dashboard */
.bill-dash { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.bill-dash > * { margin: 0; }
.bill-dash .card + .card { margin-top: 0; }
.bill-quiet { margin: 0; padding: 0 4px; }
.bill-quiet .icon { color: var(--muted); }

/* Settings → Billing */
.bill-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }

@media (max-width: 760px) {
  .line-head { display: none; }
  .line-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "desc desc desc"
      "qty price rate"
      "sac total rm";
  }
  .line-row:not(.line-head) + .line-row { padding-top: 12px; }
  .line-lab { position: static; width: auto; height: auto; overflow: visible; clip: auto; font-size: 12px; color: var(--muted); }
  .c-rm { justify-self: end; align-self: end; }
  .inv-totals { width: 100%; }
  .inv-renew-list li { flex-wrap: wrap; }
  .inv-cust-picked { flex-direction: column; }
}
