/* v38 Time & material billing. Phone first; theme variables only (light + dark). */
.tm-card { padding: 16px; display: grid; gap: 12px; margin: 0 0 14px; }
.tm-card.off { padding: 12px 16px; }
.tm-type { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.tm-type-l { font-weight: 700; font-size: .92rem; color: var(--ink-2); }
.tm-seg .seg { min-height: 40px; padding: .3rem .85rem; font-size: .9rem; }
.tm-body { display: grid; gap: 10px; min-width: 0; }
.tm-periods { gap: 6px; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; scrollbar-width: none; }
.tm-periods .chip { min-height: 38px; padding: .3rem .8rem; font-size: .86rem; white-space: nowrap; flex: none; }
.tm-hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; }
.tm-hero > div { display: grid; gap: 2px; padding: 12px; border-radius: var(--radius-md); background: var(--surface-2); min-width: 0; }
.tm-hero small { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 800; color: var(--muted); }
.tm-hero b { font-family: var(--font-display); font-size: 1.7rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--ink); }
.tm-hero span { font-size: .8rem; }
.tm-margin { background: var(--ok-bg) !important; } .tm-margin b { color: var(--ok); }
.tm-margin.neg { background: var(--bad-bg) !important; } .tm-margin.neg b { color: var(--bad); }
.tm-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.tm-sec-head h4 { margin: 0; font-size: .95rem; }
.tm-rows, .tm-pick { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.tm-rows li, .tm-pick li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--surface); min-height: 52px; }
.tm-rows li:first-child, .tm-pick li:first-child { border-top: 0; }
.tm-rows li > span, .tm-pick label > span { display: grid; gap: 2px; min-width: 0; }
.tm-rows li > span b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-rows small, .tm-pick small { color: var(--muted); font-size: .8rem; }
.tm-rows li > b, .tm-pick li > b { font-variant-numeric: tabular-nums; flex: none; }
.tm-rows li.tap { cursor: pointer; } .tm-rows li.tap:active { background: var(--surface-2); }
.tm-pick label { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.tm-pick input[type=checkbox] { width: 22px; height: 22px; flex: none; accent-color: var(--brand); }
.tm-none { margin: 0; font-size: .88rem; }
.tm-tot { margin: 4px 0 0; display: grid; gap: 4px; }
.tm-tot > div { display: flex; justify-content: space-between; font-size: .92rem; }
.tm-tot dt { color: var(--ink-2); } .tm-tot dd { margin: 0; font-variant-numeric: tabular-nums; }
.tm-tot .internal { color: var(--muted); font-style: italic; } .tm-tot .internal dt { color: var(--muted); }
.tm-tot .grand { border-top: 1px solid var(--line); padding-top: 6px; font-weight: 800; font-size: 1.05rem; }
.tm-actions { display: grid; grid-template-columns: 1fr; gap: 8px; }
.tm-actions .btn { width: 100%; justify-content: center; }
.tm-foot, .tm-inv-meta.internal { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); font-size: .78rem; }
.tm-inv-meta { margin: 6px 0 0; font-size: .85rem; color: var(--ink-2); }
.switch-row { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: .92rem; }
.switch-row input { width: 22px; height: 22px; accent-color: var(--brand); flex: none; }
/* rates sheet */
.tm-rates h3 { margin: 14px 0 2px; font-size: 1rem; }
.tm-rate-row { display: grid; grid-template-columns: 1fr 78px 78px 40px; gap: 6px; align-items: end; padding: 6px 0; border-bottom: 1px solid var(--line); }
.tm-rate-row label, .tm-w-nums label { display: grid; gap: 2px; font-size: .72rem; color: var(--muted); font-weight: 700; }
.tm-rate-row input, .tm-w-nums input { min-width: 0; width: 100%; }
.tm-workers { display: grid; gap: 8px; }
.tm-worker { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.tm-worker > b { grid-column: 1 / -1; }
.tm-w-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tm-create .tm-preview { display: grid; gap: 6px; max-height: 46vh; overflow: auto; }
.tm-create .tm-preview h4 { margin: 6px 0 0; font-size: .9rem; }
/* client backup (invoice link + PDF) */
.inv-backup { margin-top: 22px; page-break-before: auto; }
.inv-backup h2 { font-size: 1.05rem; margin: 0 0 6px; }
.inv-backup h3 { font-size: .92rem; margin: 12px 0 4px; color: #384358; }
.inv-bk-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.inv-bk-table th { text-align: left; font-weight: 700; color: #6a6f7a; border-bottom: 1px solid #d6ccbb; padding: 4px 6px; }
.inv-bk-table td { border-bottom: 1px solid #ece4d6; padding: 5px 6px; vertical-align: top; }
.inv-bk-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.inv-bk-table small { color: #6a6f7a; }
@media (max-width: 380px) { .tm-hero { grid-template-columns: 1fr; } .tm-rate-row { grid-template-columns: 1fr 64px 64px 36px; } }
