/* ================================================================
   Templates & costs (TC, wave22-tc) — the one home for what's
   scattered: quote templates, the cost catalogue, the category
   master, cost codes, the to-do template library window, and the
   Products door. Mirrors the register CSS conventions of the
   money surfaces (po-/inv-): navy active tabs, quiet cards, one
   gold reserved for the single most important figure.
   ================================================================ */

.tc-context { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.tc-context p { margin: 0; font-size: 14px; }

.tc-tabs { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.tc-tab {
  appearance: none; border: 1px solid var(--line); background: var(--card-bg, #fff);
  color: var(--ink); border-radius: 999px; padding: 6px 14px; font-size: 13.5px; cursor: pointer;
}
.tc-tab.active { background: var(--navy, #0B2235); color: #fff; border-color: var(--navy, #0B2235); }

.tc-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.tc-toolbar-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.tc-filterbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 12px; }
.tc-f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.tc-f input, .tc-f select {
  font-size: 14px; padding: 7px 9px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--card-bg, #fff); color: var(--ink);
}
.tc-f-grow { flex: 1 1 220px; }
.tc-f-grow input { width: 100%; }

.tc-note { font-size: 12.5px; color: var(--muted); margin: 0 0 12px; }
.tc-count { font-size: 13px; color: var(--muted); margin: 0 0 10px; }

/* --- quote template cards (Billdr's shape, D34) --- */
.tc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.tc-card {
  background: var(--card-bg, #fff); border: 1px solid var(--line);
  border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 8px;
}
.tc-card.retired { opacity: .72; }
.tc-card-head { display: flex; align-items: flex-start; gap: 10px; }
.tc-card-name { margin: 0; font-size: 16.5px; font-weight: 650; }
.tc-card-price { margin: 0; font-size: 21px; font-weight: 650; color: #b98f3e; }
.tc-card-meta { margin: 0; font-size: 13px; color: var(--muted); }
.tc-card-desc { margin: 0; font-size: 13.5px; color: var(--ink); }
.tc-card-actions { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* --- tables --- */
.tc-table-wrap { overflow-x: auto; }
.tc-table { width: 100%; border-collapse: collapse; }
.tc-table th {
  text-align: left; font-size: 11px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line);
}
.tc-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
.tc-num { text-align: right; white-space: nowrap; }
.tc-strong { font-weight: 600; }
.tc-sub { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

.tc-src {
  display: inline-block; font-size: 11px; font-weight: 600; border-radius: 999px;
  padding: 2px 8px; white-space: nowrap;
}
.tc-src-seed { background: #eef1f4; color: var(--muted); }
.tc-src-added { background: #e3f5ea; color: #177348; }
.tc-src-edited { background: #fdf3e0; color: #8a5a12; }

/* --- fix pass 5: catalogue pager + codes banner --- */
.tc-pager { display: flex; align-items: center; gap: 12px; margin-top: 12px; font-size: 13.5px; color: var(--muted); }
.tc-banner {
  background: #fdf3e0; color: #8a5a12; border: 1px solid #ecd9ac;
  border-radius: 8px; padding: 9px 12px; font-size: 13px; margin: 0 0 14px;
}

.tc-pill {
  display: inline-block; font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 2px 9px;
}
.tc-pill-on { background: #e3f5ea; color: #177348; }
.tc-pill-off { background: #eef1f4; color: var(--muted); }

/* --- to-do template rows --- */
.tc-todo-items { margin: 6px 0 2px; padding-left: 20px; font-size: 13.5px; color: var(--ink); }
.tc-todo-items li { margin: 2px 0; }

/* --- the template editor --- */
.tc-ed-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.tc-ed-title h2 { margin: 0; font-size: 22px; }
.tc-ed-title p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
.tc-ed-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.tc-ed-settings {
  display: flex; gap: 14px; flex-wrap: wrap; align-items: end;
  background: var(--card-bg, #fff); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 14px;
}
.tc-ed-settings .tc-f input, .tc-ed-settings .tc-f select { min-width: 110px; }
.tc-mode { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.tc-mode button {
  appearance: none; border: 0; background: var(--card-bg, #fff); color: var(--ink);
  padding: 7px 12px; font-size: 13.5px; cursor: pointer;
}
.tc-mode button.active { background: var(--navy, #0B2235); color: #fff; }

.tc-cat {
  background: var(--card-bg, #fff); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px 16px; margin-bottom: 12px;
}
.tc-cat-head { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 10px; }
.tc-cat-head .tc-f-grow input { font-weight: 600; }
.tc-cat-labour { font-size: 12.5px; color: var(--muted); margin: 0 0 10px; }
.tc-cat-totals { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.tc-cat-totals b { color: var(--ink); }

.tc-lines { width: 100%; border-collapse: collapse; }
.tc-lines th {
  text-align: left; font-size: 11px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); padding: 6px 6px; border-bottom: 1px solid var(--line);
}
.tc-lines td { padding: 5px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tc-lines input, .tc-lines select {
  font-size: 13.5px; padding: 6px 7px; border: 1px solid var(--line);
  border-radius: 7px; background: var(--card-bg, #fff); color: var(--ink); width: 100%;
}
.tc-lines .tc-l-title { min-width: 200px; }
.tc-lines .tc-l-num { width: 92px; }
.tc-lines .tc-l-qty { width: 64px; }
.tc-lines .tc-l-unit { width: 96px; }
.tc-lines .tc-l-code { width: 150px; }
.tc-lines .tc-l-total { white-space: nowrap; font-size: 13.5px; padding-top: 10px; }
.tc-lines .tc-l-x { width: 34px; }

.tc-breakdown {
  background: var(--card-bg, #fff); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px 16px; margin: 14px 0;
}
.tc-breakdown h3 { margin: 0 0 10px; font-size: 14px; }
.tc-bd-row { display: flex; justify-content: space-between; gap: 14px; font-size: 14px; padding: 3px 0; }
.tc-bd-row.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 9px; font-weight: 650; }
.tc-bd-row.grand { font-size: 16px; }
.tc-bd-row.grand .tc-bd-v { color: #b98f3e; }
.tc-bd-k { color: var(--muted); }
.tc-bd-row.total .tc-bd-k, .tc-bd-row.grand .tc-bd-k { color: var(--ink); }

.tc-savebar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 14px 0; }
.tc-savestate { font-size: 13px; color: var(--muted); }
.tc-savestate.bad { color: #9a3030; }

/* --- dialogs ride the shared fx-dialog chrome; local bits --- */
.tc-dlg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.tc-dlg-grid .full { grid-column: 1 / -1; }
.tc-conflict { border: 1px solid var(--line); padding: 10px 12px; margin-bottom: 8px; }
.tc-conflict label { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }

/* ======================= DW1 · Templates & cost codes (design wave, 2026-10-17) ======================= */
/* Capture §10 + rules 2, 4, 5, 6, 8, 10. CSS only; no class or id
 * changes. #view-templates is added to selectors that must out-rank
 * design-system.css's long `.btn:not(...)` chain. */

/* -- tab strip: plain text, active = navy bold + 3px gold bar (the .ptab look) -- */
body.skin-billdr #app .tc-tabs {
  gap: 4px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin;
  border-bottom: 1px solid var(--ds-line); margin: 0 0 24px; align-items: stretch;
}
body.skin-billdr #app .tc-tab {
  flex: none; background: none; border: 0; border-bottom: 3px solid transparent; border-radius: 0; margin-bottom: -1px;
  padding: 10px 10px 11px; font: inherit; font-size: var(--ds-fs); font-weight: 500; color: var(--ds-muted); white-space: nowrap;
}
body.skin-billdr #app .tc-tab:hover { color: var(--ds-navy); }
body.skin-billdr #app .tc-tab.active { background: none; color: var(--ds-navy); font-weight: 700; border-color: transparent; border-bottom-color: var(--ds-navy); }   /* parity pass: active tab is navy (gold = main action + key number only) */
body.skin-billdr #app .tc-tab:focus-visible { outline: none; box-shadow: inset var(--ds-focus); border-radius: 6px 6px 0 0; }

/* -- "← Templates & costs" door above the editor: the shared back-link -- */
body.skin-billdr #app .tc-context { margin-bottom: 14px; }
body.skin-billdr #app #view-templates #tc-back { background: transparent; border-color: transparent; padding-left: 4px; color: var(--ds-muted); }
body.skin-billdr #app #view-templates #tc-back:hover { color: var(--ds-navy); background: transparent; }
body.skin-billdr #app .tc-context p,
body.skin-billdr #app #tc-context-name { font-size: var(--ds-fs-sm); }

/* -- toolbar: small grey helper left, actions right (primary gold pill,
 *    the rest real outline buttons — wave42: they were flattened to bare
 *    navy text (Micheal, 2026-10-21: "some of the buttons are not
 *    buttons"); a toolbar <button> keeps its button shape here now) -- */
body.skin-billdr #app .tc-toolbar { gap: 12px 16px; margin: 0 0 16px; min-height: var(--ds-ctl); }
body.skin-billdr #app :is(.tc-note, .tc-count) { font-size: var(--ds-fs-sm); color: var(--ds-muted); max-width: 80ch; line-height: 1.5; }
body.skin-billdr #app .tc-toolbar-actions { gap: 8px 18px; align-items: center; }
body.skin-billdr #app #view-templates .tc-toolbar-actions .btn:not(.btn-primary) {
  min-height: var(--ds-ctl-sm); padding: 0 12px; background: var(--ds-card); border: 1px solid var(--ds-line-strong); border-radius: var(--ds-r-ctl); color: var(--ds-ink); font-weight: 600;
}
body.skin-billdr #app #view-templates .tc-toolbar-actions .btn:not(.btn-primary):hover:not(:disabled) { background: var(--ds-tint); border-color: #b9c2cd; }

/* -- filter bar: the shared look. Captions stay in the DOM as the
 *    controls' names; only hidden from sight (font-size 0). -- */
body.skin-billdr #app .tc-filterbar { gap: 12px; align-items: center; margin: 0 0 16px; }
body.skin-billdr #app .tc-filterbar .tc-f { font-size: 0; line-height: 0; gap: 0; color: transparent; }
body.skin-billdr #app .tc-filterbar .tc-f-grow { flex: 1 1 320px; max-width: 520px; }
body.skin-billdr #app #view-templates .tc-filterbar .tc-f :is(input, select) {
  min-height: var(--ds-ctl); font-size: var(--ds-fs-sm); line-height: normal; color: var(--ds-ink);
  border: 1px solid var(--ds-line); border-radius: var(--ds-r-ctl);
}
body.skin-billdr #app #view-templates .tc-filterbar .tc-f select { min-width: 190px; padding: 0 34px 0 14px; font-weight: 500; }
body.skin-billdr #app #view-templates .tc-filterbar .tc-f input[type="search"] { padding: 0 14px 0 38px; }

/* -- tables: white 12px card, header no fill, 12px grey sentence case,
 *    hairlines, no zebra, money right-aligned -- */
body.skin-billdr #app .tc-table-wrap { background: var(--ds-card); border: 1px solid var(--ds-line); border-radius: var(--ds-r); overflow-x: auto; }
body.skin-billdr #app .tc-table { border-collapse: separate; border-spacing: 0; background: var(--ds-card); }
body.skin-billdr #app .tc-table th {
  font-size: var(--ds-fs-xs); font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--ds-muted);
  background: var(--ds-card); padding: 14px 16px 12px; border-bottom: 1px solid var(--ds-line); white-space: nowrap; vertical-align: bottom;
}
body.skin-billdr #app .tc-table td { font-size: var(--ds-fs-sm); color: var(--ds-ink); padding: 18px 16px; border-bottom: 1px solid var(--ds-hair); vertical-align: middle; }
body.skin-billdr #app .tc-table tbody tr:last-child td { border-bottom: 0; }
body.skin-billdr #app .tc-table tbody tr:hover td { background: var(--ds-tint); }
body.skin-billdr #app .tc-table td.muted { color: var(--ds-muted); }
body.skin-billdr #app .tc-table tr.muted td { color: var(--ds-faint); }
body.skin-billdr #app .tc-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
body.skin-billdr #app .tc-strong { display: inline; color: var(--ds-navy); font-weight: 700; font-size: var(--ds-fs); }
body.skin-billdr #app .tc-sub { color: var(--ds-muted); font-size: var(--ds-fs-sm); line-height: 1.4; margin-top: 3px; max-width: 70ch; }
body.skin-billdr #app .tc-todo-items { font-size: var(--ds-fs-sm); color: var(--ds-ink); margin: 8px 0 0; }
body.skin-billdr #app .tc-todo-items b { color: var(--ds-navy); }
/* row actions (Edit / View tasks / Hide): navy text-links at the right edge */
body.skin-billdr #app .tc-table td:last-child:has(> .btn:only-child) { text-align: right; white-space: nowrap; width: 1%; }
body.skin-billdr #app #view-templates .tc-table td > .btn:is(.btn-ghost, :not(.btn-primary)) {
  min-height: var(--ds-ctl-sm); padding: 0 8px; background: none; border: 0; color: var(--ds-navy); font-weight: 600; font-size: var(--ds-fs-sm);
}
body.skin-billdr #app #view-templates .tc-table td > .btn:is(.btn-ghost, :not(.btn-primary)):hover:not(:disabled) { background: var(--ds-bg); color: var(--ds-navy); }

/* -- pills: shared pastels (Active green, Retired neutral) -- */
body.skin-billdr #app :is(.tc-pill, .tc-src) { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: var(--ds-r-pill); font-size: 12px; font-weight: 600; letter-spacing: 0; }
body.skin-billdr #app :is(.tc-pill-on, .tc-src-added) { background: var(--ds-ok-bg); color: var(--ds-ok-ink); }
body.skin-billdr #app :is(.tc-pill-off, .tc-src-seed) { background: var(--ds-neutral-bg); color: var(--ds-neutral-ink); }
body.skin-billdr #app .tc-src-edited { background: var(--ds-orange-bg); color: var(--ds-orange-ink); }

/* -- empty states inside a tab: plain grey text, left, in the card manner -- */
body.skin-billdr #app #tc-body > .empty { background: var(--ds-card); border: 1px solid var(--ds-line); border-radius: var(--ds-r); padding: 22px 20px; text-align: left; }

/* -- the amber note (shared .attn look) -- */
body.skin-billdr #app .tc-banner {
  background: var(--ds-warn-bg); color: var(--ds-warn-ink); border: 1px solid var(--ds-warn-line);
  border-radius: var(--ds-r); padding: 12px 16px; font-size: var(--ds-fs-sm); line-height: 1.5; margin: 0 0 20px;
}

/* -- catalogue pager: real paging, quiet. "Page x of y" grey; prev /
 *    next gold text-links; disabled faint. No invented « ‹ › » icons. -- */
body.skin-billdr #app .tc-pager { justify-content: flex-end; gap: 16px; margin: 12px 4px 0; font-size: var(--ds-fs-sm); color: var(--ds-muted); }
body.skin-billdr #app #view-templates .tc-pager .btn {
  min-height: var(--ds-ctl-sm); padding: 0 4px; background: none; border: 0; color: var(--ds-navy); font-weight: 600; font-size: var(--ds-fs-sm);
}
body.skin-billdr #app #view-templates .tc-pager .btn:hover:not(:disabled) { background: none; text-decoration: underline; text-underline-offset: 3px; }
body.skin-billdr #app #view-templates .tc-pager .btn:disabled { color: var(--ds-faint); background: none; cursor: default; }

/* -- cost codes: Billdr's catalogue shape — each division its own white
 *    card. The division's un-classed <h3> (inline margin, hence the one
 *    !important) becomes the card's heading; its table wrap the body. -- */
body.skin-billdr #app #tc-body > h3:has(+ .tc-table-wrap) {
  margin: 20px 0 0 !important; padding: 18px 20px 6px; background: var(--ds-card);
  border: 1px solid var(--ds-line); border-bottom: 0; border-radius: var(--ds-r) var(--ds-r) 0 0;
  font-size: var(--ds-fs-md); font-weight: 700; color: var(--ds-navy);
}
body.skin-billdr #app #tc-body > h3 + .tc-table-wrap { border-top: 0; border-radius: 0 0 var(--ds-r) var(--ds-r); }
body.skin-billdr #app #tc-body > h3 + .tc-table-wrap .tc-table td { padding-top: 14px; padding-bottom: 14px; }
body.skin-billdr #app #tc-body > h3 + .tc-table-wrap .tc-table th:first-child,
body.skin-billdr #app #tc-body > h3 + .tc-table-wrap .tc-table td:first-child { width: 120px; padding-left: 20px; }
/* the Retired heading over the retired template cards */
body.skin-billdr #app #tc-body > h3:has(+ .tc-cards) { font-size: var(--ds-fs-md); font-weight: 700; color: var(--ds-navy); margin: 28px 0 12px !important; }

/* -- quote template cards: Billdr's two-column white card grid — bold
 *    title, grey description, price as a gold-tinted pill top-right, grey
 *    meta bottom-right. Grid areas place the existing children; there is
 *    no thumbnail in the data, so none is drawn. -- */
body.skin-billdr #app .tc-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
body.skin-billdr #app .tc-card {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start;
  grid-template-areas: "head price" "desc desc" "actions meta";
  grid-template-rows: auto auto 1fr; gap: 8px 16px;
  background: var(--ds-card); border: 1px solid var(--ds-line); border-radius: var(--ds-r); padding: 20px 24px; box-shadow: none;
}
body.skin-billdr #app .tc-card.retired { opacity: 1; background: var(--ds-tint); }
body.skin-billdr #app .tc-card-head { grid-area: head; align-items: center; gap: 10px; flex-wrap: wrap; }
body.skin-billdr #app .tc-card-name { font-size: var(--ds-fs-md); font-weight: 700; color: var(--ds-navy); line-height: 1.35; }
body.skin-billdr #app .tc-card-price {
  grid-area: price; justify-self: end; padding: 4px 12px; border-radius: var(--ds-r-pill);
  background: var(--ds-gold-tint); color: var(--ds-gold-ink); font-size: var(--ds-fs-sm); font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums;
}
body.skin-billdr #app .tc-card-desc { grid-area: desc; font-size: var(--ds-fs-sm); color: var(--ds-muted); line-height: 1.5; margin: 0 0 6px; }
body.skin-billdr #app .tc-card-meta { grid-area: meta; align-self: end; justify-self: end; font-size: var(--ds-fs-xs); color: var(--ds-muted); white-space: nowrap; padding-bottom: 8px; }
body.skin-billdr #app .tc-card-actions { grid-area: actions; align-self: end; margin-top: 8px; align-items: center; gap: 4px 16px; }
body.skin-billdr #app #view-templates .tc-card-actions .btn.btn-primary { min-height: var(--ds-ctl-sm); padding: 0 14px; font-size: var(--ds-fs-sm); border-radius: var(--ds-r-sm); margin-right: 4px; }
body.skin-billdr #app #view-templates .tc-card-actions .btn:not(.btn-primary) {
  min-height: var(--ds-ctl-sm); padding: 0 12px; background: var(--ds-card); border: 1px solid var(--ds-line-strong); border-radius: var(--ds-r-ctl); color: var(--ds-ink); font-weight: 600; font-size: var(--ds-fs-sm);
}
body.skin-billdr #app #view-templates .tc-card-actions .btn:not(.btn-primary):hover:not(:disabled) { background: var(--ds-tint); border-color: #b9c2cd; }
/* Delete (retire) is the destructive one: red text (rule 10) */
body.skin-billdr #app #view-templates .tc-card-actions .btn[data-tc-retire] { color: var(--ds-danger); }

/* ======================= template editor (templates-edit.js tcEdRender) ======================= */
body.skin-billdr #app .tc-ed-head { gap: 16px; margin-bottom: 20px; align-items: flex-end; }
body.skin-billdr #app .tc-ed-title h2 { font-size: var(--ds-fs-xl); font-weight: 700; color: var(--ds-navy); }
body.skin-billdr #app .tc-ed-title p { font-size: var(--ds-fs-sm); color: var(--ds-muted); max-width: 80ch; }
/* PDF previews: secondaries = the gold outline pill */
body.skin-billdr #app #view-templates .tc-ed-actions .btn,
body.skin-billdr #app #view-templates :is(#tced-add-cat, #tced-add-cat-master) {
  background: var(--ds-card); color: var(--ds-navy); border: 1px solid var(--ds-navy); font-weight: 600;
}
body.skin-billdr #app #view-templates .tc-ed-actions .btn:hover:not(:disabled),
body.skin-billdr #app #view-templates :is(#tced-add-cat, #tced-add-cat-master):hover:not(:disabled) { background: var(--ds-nav-active); color: var(--ds-navy); }
/* settings + category cards: white 12px, bold navy small field labels (§12 form look) */
body.skin-billdr #app :is(.tc-ed-settings, .tc-cat, .tc-breakdown) {
  background: var(--ds-card); border: 1px solid var(--ds-line); border-radius: var(--ds-r); box-shadow: none; padding: 20px 24px;
}
body.skin-billdr #app .tc-ed-settings { gap: 14px 16px; margin-bottom: 20px; align-items: end; }
body.skin-billdr #app .tc-cat { margin-bottom: 16px; }
body.skin-billdr #app .tc-cat-head { gap: 12px 16px; margin-bottom: 12px; align-items: end; }
body.skin-billdr #app :is(.tc-ed-settings, .tc-cat-head) .tc-f { font-size: 12.5px; font-weight: 600; color: var(--ds-navy); gap: 6px; }
body.skin-billdr #app #view-templates :is(.tc-ed-settings, .tc-cat-head) .tc-f :is(input, select) {
  min-height: var(--ds-ctl); padding: 0 12px; font-size: var(--ds-fs); font-weight: 400; border: 1px solid var(--ds-line); border-radius: var(--ds-r-ctl);
}
body.skin-billdr #app #view-templates :is(.tc-ed-settings, .tc-cat-head) .tc-f select { padding-right: 34px; }
body.skin-billdr #app #view-templates .tc-cat-head .tc-f-grow input { font-weight: 700; color: var(--ds-navy); }
/* Markup | Margin: the segmented control (rule 8) */
body.skin-billdr #app .tc-mode { display: inline-flex; background: #e9edf3; border: 0; border-radius: var(--ds-r-ctl); padding: 3px; gap: 2px; overflow: visible; min-height: var(--ds-ctl); box-sizing: border-box; }
body.skin-billdr #app .tc-mode button {
  background: transparent; border: 0; border-radius: var(--ds-r-sm); padding: 6px 14px;
  font: inherit; font-size: var(--ds-fs-sm); font-weight: 500; color: var(--ds-muted);
}
body.skin-billdr #app .tc-mode button:hover { color: var(--ds-navy); }
body.skin-billdr #app .tc-mode button.active { background: var(--ds-card); color: var(--ds-navy); font-weight: 600; box-shadow: 0 1px 3px rgba(15, 34, 51, .14); }
/* Delete category: destructive red text */
body.skin-billdr #app #view-templates .tc-cat-head [data-tced-cat-del] { background: none; border: 0; color: var(--ds-danger); font-weight: 600; padding: 0 4px; }
body.skin-billdr #app #view-templates .tc-cat-head [data-tced-cat-del]:hover { background: none; text-decoration: underline; text-underline-offset: 3px; }
body.skin-billdr #app .tc-cat-labour { font-size: var(--ds-fs-xs); color: var(--ds-muted); line-height: 1.5; }
/* task lines: shared table head, hairlines, quieter inputs */
body.skin-billdr #app .tc-lines { border-collapse: separate; border-spacing: 0; }
body.skin-billdr #app .tc-lines th {
  font-size: var(--ds-fs-xs); font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--ds-muted);
  padding: 10px 6px 8px; border-bottom: 1px solid var(--ds-line); vertical-align: bottom;
}
body.skin-billdr #app .tc-lines td { padding: 8px 6px; border-bottom: 1px solid var(--ds-hair); vertical-align: middle; }
body.skin-billdr #app #view-templates .tc-lines :is(input, select) { min-height: 36px; padding: 0 10px; font-size: var(--ds-fs-sm); border: 1px solid var(--ds-line); border-radius: var(--ds-r-sm); }
body.skin-billdr #app #view-templates .tc-lines select { padding-right: 30px; background-position: right 8px center; }
body.skin-billdr #app .tc-lines .tc-l-total { padding-top: 8px; font-size: var(--ds-fs-sm); font-weight: 600; color: var(--ds-navy); }
body.skin-billdr #app #view-templates .tc-lines [data-tced-line-del] { min-height: 32px; width: 32px; padding: 0; background: none; border: 1px solid transparent; color: var(--ds-faint); }
body.skin-billdr #app #view-templates .tc-lines [data-tced-line-del]:hover { color: var(--ds-danger); background: var(--ds-bg); border-color: var(--ds-line); }
/* "+ Add task" / "Add from my cost catalogue": Billdr's "+ Create cost code" link under each card */
body.skin-billdr #app #view-templates .tc-cat :is([data-tced-line-add], [data-tced-line-catalog]) {
  min-height: var(--ds-ctl-sm); padding: 0 2px; margin-right: 12px; background: none; border: 0; color: var(--ds-navy); font-weight: 600; font-size: var(--ds-fs-sm);
}
body.skin-billdr #app #view-templates .tc-cat :is([data-tced-line-add], [data-tced-line-catalog]):hover { background: none; text-decoration: underline; text-underline-offset: 3px; }
body.skin-billdr #app .tc-cat-totals { font-size: var(--ds-fs-sm); color: var(--ds-muted); padding-top: 12px; border-top: 1px solid var(--ds-hair); }
body.skin-billdr #app .tc-cat-totals b { color: var(--ds-navy); }
/* costs breakdown: label grey, totals bold navy */
body.skin-billdr #app .tc-breakdown { margin: 20px 0; }
body.skin-billdr #app .tc-breakdown h3 { font-size: var(--ds-fs-lg); font-weight: 700; color: var(--ds-navy); margin: 0 0 12px; }
body.skin-billdr #app .tc-bd-row { font-size: var(--ds-fs-sm); padding: 5px 0; font-variant-numeric: tabular-nums; }
body.skin-billdr #app .tc-bd-v { color: var(--ds-ink); }
body.skin-billdr #app .tc-bd-row.total { border-top: 1px solid var(--ds-line); font-weight: 700; }
body.skin-billdr #app .tc-bd-row.total :is(.tc-bd-k, .tc-bd-v) { color: var(--ds-navy); }
body.skin-billdr #app .tc-bd-row.grand { font-size: var(--ds-fs-md); }
body.skin-billdr #app .tc-bd-row.grand .tc-bd-v { color: var(--ds-navy); font-size: var(--ds-fs-lg); }
body.skin-billdr #app .tc-savebar { gap: 14px; margin: 20px 0; }
body.skin-billdr #app .tc-savestate { font-size: var(--ds-fs-sm); color: var(--ds-muted); }
body.skin-billdr #app .tc-savestate.bad { color: var(--ds-danger); font-weight: 600; }
/* dialog bits */
body.skin-billdr .tc-conflict { border-color: var(--ds-line); border-radius: var(--ds-r-ctl); font-size: var(--ds-fs-sm); }

@media (max-width: 760px) {
  body.skin-billdr #app .tc-cards { grid-template-columns: 1fr; }
  body.skin-billdr #app .tc-card { padding: 16px; }
  body.skin-billdr #app .tc-toolbar-actions { margin-left: 0; }
  body.skin-billdr #app .tc-filterbar .tc-f { flex: 1 1 100%; max-width: none; }
}

/* ======================= DW2 P04 · Templates & cost codes: editors + deletes (2026-10-18) =======================
 * Plain rules = structure (holds in the Navy appearance too); the
 * body.skin-billdr rules = the light-skin look. */

/* -- read-only + "why" notes, status line -- */
.tc-readonly { margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.tc-why { margin: 0 0 14px; font-size: 13px; color: var(--muted); max-width: 90ch; line-height: 1.5; }
.tc-status:empty { display: none; }
.tc-status .rk-err { margin: 0 0 12px; }
.tc-status .rk-err.tc-status-info { color: var(--muted); }
.tc-inline-hint { margin: -4px 0 12px; }

/* -- small controls -- */
.tc-icon-btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0; border: 1px solid transparent; border-radius: 7px;
  background: none; color: var(--muted); cursor: pointer;
}
.tc-icon-btn:hover { background: rgba(127, 127, 127, .12); color: var(--ink); }
.tc-icon-btn .ico { width: 17px; height: 17px; stroke-width: 1.8; }
.tc-icon-danger:hover { color: #b3402e; }
.tc-row-icons { white-space: nowrap; text-align: right; width: 1%; }
.tc-row-icons > * { vertical-align: middle; }
.tc-link {
  appearance: none; background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; font-size: 13.5px; font-weight: 600; color: var(--navy, #0b2235);
}
.tc-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.tc-danger-link .ico { margin-right: 4px; }
.tc-tick { width: 34px; }
.tc-in {
  font: inherit; font-size: 13.5px; padding: 5px 8px; border: 1px solid var(--line);
  border-radius: 7px; background: var(--card-bg, #fff); color: var(--ink); box-sizing: border-box; min-width: 0;
}

/* -- catalogue inline rows -- */
.tc-cat-inline td { vertical-align: top; }
.tc-cat-inline .tc-ci-task { min-width: 220px; }
.tc-cat-inline .tc-ci-task .tc-in { display: block; width: 100%; }
.tc-cat-inline .tc-in-desc { margin-top: 4px; font-size: 12.5px; }
.tc-cat-inline .tc-ci-cat { min-width: 160px; }
.tc-cat-inline .tc-ci-cat .tc-in { display: block; width: 100%; }
.tc-cat-inline .tc-in-code { margin-top: 4px; font-size: 12.5px; }
.tc-cat-inline .tc-ci-qty { white-space: nowrap; }
.tc-cat-inline .tc-ci-seedqty { margin-right: 6px; }
.tc-cat-inline .tc-in-unit { width: 72px; }
.tc-cat-inline .tc-in-money { width: 92px; text-align: right; }
.tc-cat-inline .tc-ci-total { padding-top: 14px; }
.tc-cat-inline .rk-err { font-size: 12.5px; margin-top: 4px; }
tr.tc-row-saving { opacity: .65; }
tr.tc-row-saved td, .tc-code-row.tc-row-saved { transition: background .3s; background: rgba(46, 160, 90, .08); }
tr.tc-row-sel td { background: rgba(185, 143, 62, .07); }
.qm-form-actions .tc-dlg-del { margin-right: auto; }

/* -- cost codes: division cards -- */
.tc-codes-meta { display: flex; align-items: center; gap: 14px; margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.tc-divs { display: flex; flex-direction: column; gap: 14px; }
.tc-div { background: var(--card-bg, #fff); border: 1px solid var(--line); border-radius: 10px; }
.tc-div-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; }
.tc-div.collapsed .tc-div-head { padding-bottom: 12px; }
.tc-div-chev { appearance: none; background: none; border: 0; padding: 4px; cursor: pointer; color: var(--muted); display: inline-flex; border-radius: 6px; }
.tc-div-chev:hover { color: var(--ink); }
.tc-div-h { margin: 0; font-size: 15px; font-weight: 700; }
.tc-div-count { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.tc-div-body { padding: 0 16px 12px; }
.tc-code-row {
  display: grid; grid-template-columns: 84px minmax(0, 1fr) 130px 34px; gap: 10px; align-items: center;
  padding: 8px 0; border-top: 1px solid var(--line);
}
.tc-code-row-ro { grid-template-columns: 84px minmax(0, 1fr) auto; }
/* wave646: with QuickBooks mapping on, a row carries SIX cells (code,
 * name, QBO expense, QBO income, status, trash) but the base grid
 * only has four tracks — in the Settings door (the Templates view
 * has its own scoped grid in dw3-templates.css) the extra cells
 * overflowed and wrapped, the "messed up" cost-code table. Give the
 * qbo rows their own tracks, mirroring the Templates view's. */
.tc-code-row.qbo { grid-template-columns: 76px minmax(140px, 1.2fr) minmax(120px, 1fr) minmax(120px, 1fr) 112px 36px; }
.tc-code-row-ro.qbo { grid-template-columns: 76px minmax(140px, 1.2fr) minmax(120px, 1fr) minmax(120px, 1fr) 112px; }
.tc-code-row .tc-code-qbo { min-width: 0; }
.tc-code-row .tc-code-err { grid-column: 1 / -1; margin: 0; }
.tc-code-row .tc-code-err[hidden] { display: none; }
.tc-code-row.tc-row-saving { opacity: .65; }
.tc-code-num { font-weight: 700; font-variant-numeric: tabular-nums; padding: 5px 8px; border-radius: 7px; background: rgba(127, 127, 127, .08); text-align: center; }
.tc-code-new { grid-template-columns: 84px minmax(0, 1fr) auto; margin: 0; }
.tc-code-newacts { display: flex; gap: 6px; }
.tc-div-add { margin-top: 10px; }

/* -- selections: the group's items -- */
.tc-subrow > td { padding-top: 0; }
.tc-sel-items { list-style: none; margin: 0 0 8px; padding: 0; }
.tc-sel-items li { display: flex; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.tc-sel-label { flex: 1 1 auto; }
.tc-sel-allow { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.tc-sel-none { margin: 0 0 8px; }

/* -- template import plan -- */
.tc-imp-plan:empty { display: none; }
.tc-imp-sum { margin: 0 0 8px; font-size: 13.5px; }
.tc-imp-row { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; font-size: 13.5px; cursor: pointer; }
.tc-imp-warn { margin: 8px 0 0; font-size: 13px; }

@media (max-width: 900px) {
  .tc-code-row.qbo { grid-template-columns: 64px minmax(0, 1fr) 34px; }
  .tc-code-row.qbo .tc-code-qbo, .tc-code-row.qbo .tc-code-status { grid-column: 2 / 3; }
  .tc-code-row.qbo .tc-icon-btn { grid-column: 3 / 4; grid-row: 1 / 2; }
}
@media (max-width: 760px) {
  .tc-code-row { grid-template-columns: 64px minmax(0, 1fr) 34px; }
  .tc-code-row .tc-code-status { grid-column: 2 / 3; }
}

/* -- light skin -- */
body.skin-billdr #app .tc-readonly {
  background: var(--ds-card); border: 1px solid var(--ds-line); border-radius: var(--ds-r);
  padding: 12px 16px; font-size: var(--ds-fs-sm); color: var(--ds-muted); margin: -8px 0 20px;
}
body.skin-billdr #app .tc-why { font-size: var(--ds-fs-sm); color: var(--ds-muted); margin: -4px 0 16px; }
body.skin-billdr #app .tc-status .rk-err.tc-status-info { color: var(--ds-muted); }
body.skin-billdr #app .tc-icon-btn { color: var(--ds-muted); border-radius: var(--ds-r-sm); }
body.skin-billdr #app .tc-icon-btn:hover { background: var(--ds-bg); border-color: var(--ds-line); color: var(--ds-navy); }
body.skin-billdr #app .tc-icon-btn.tc-icon-danger { color: var(--ds-danger); }
body.skin-billdr #app .tc-icon-btn.tc-icon-danger:hover { color: var(--ds-danger); }
body.skin-billdr #app .tc-link { color: var(--ds-navy); font-size: var(--ds-fs-sm); }
body.skin-billdr #app .tc-link:hover { color: var(--ds-navy); }
/* "Delete all" / "Delete selected": Billdr's red text action */
body.skin-billdr #app #view-templates .tc-toolbar-actions .btn.tc-danger-link:not(.btn-primary),
body.skin-billdr #app #view-templates .tc-toolbar-actions .btn.tc-danger-link:not(.btn-primary):hover:not(:disabled) { color: var(--ds-danger); }
body.skin-billdr .fx-overlay .qm-form-actions .tc-dlg-del { color: var(--ds-danger); background: none; border-color: transparent; }
body.skin-billdr #app #view-templates .tc-in {
  min-height: 34px; padding: 0 10px; font-size: var(--ds-fs-sm); color: var(--ds-ink);
  border: 1px solid var(--ds-line); border-radius: var(--ds-r-sm); background: var(--ds-card);
}
body.skin-billdr #app #view-templates select.tc-in { padding-right: 28px; background-position: right 8px center; }
body.skin-billdr #app #view-templates .tc-in:hover { border-color: var(--ds-line-strong); }
body.skin-billdr #app #view-templates .tc-in:focus { outline: none; border-color: var(--ds-gold); box-shadow: var(--ds-focus); }
body.skin-billdr #app #view-templates .tc-cat-inline .tc-in-name { font-weight: 700; color: var(--ds-navy); }
body.skin-billdr #app #view-templates .tc-cat-inline :is(.tc-in-desc, .tc-in-code) { min-height: 30px; font-size: var(--ds-fs-xs); color: var(--ds-muted); }
body.skin-billdr #app .tc-cat-inline td { padding: 12px 10px; }
body.skin-billdr #app .tc-cat-inline td:first-child { padding-left: 16px; }
body.skin-billdr #app .tc-cat-inline .tc-ci-total { padding-top: 20px; font-weight: 700; color: var(--ds-navy); }
body.skin-billdr #app .tc-cat-inline .tc-ci-seedqty { color: var(--ds-muted); font-size: var(--ds-fs-sm); }
body.skin-billdr #app .tc-table tr.tc-row-sel td { background: var(--ds-tint); }   /* parity pass: a selected row is a navy tint, not gold */
body.skin-billdr #app .tc-table tr.tc-row-saved td { background: var(--ds-ok-bg); }

/* cost codes: each division a white 12px card */
body.skin-billdr #app .tc-codes-meta { font-size: var(--ds-fs-sm); color: var(--ds-muted); margin: -4px 0 16px; }
body.skin-billdr #app .tc-divs { gap: 16px; }
body.skin-billdr #app .tc-div { background: var(--ds-card); border-color: var(--ds-line); border-radius: var(--ds-r); }
body.skin-billdr #app .tc-div-head { padding: 16px 20px 12px; }
body.skin-billdr #app .tc-div-h { font-size: var(--ds-fs-md); color: var(--ds-navy); }
body.skin-billdr #app .tc-div-count { font-size: var(--ds-fs-xs); color: var(--ds-muted); }
body.skin-billdr #app .tc-div-chev { color: var(--ds-muted); }
body.skin-billdr #app .tc-div-chev:hover { color: var(--ds-navy); background: var(--ds-bg); }
body.skin-billdr #app .tc-div-body { padding: 0 20px 16px; }
body.skin-billdr #app .tc-code-row { border-top-color: var(--ds-hair); padding: 10px 0; }
body.skin-billdr #app .tc-code-row.tc-row-saved { background: var(--ds-ok-bg); }
body.skin-billdr #app .tc-code-num { background: var(--ds-bg); border: 1px solid var(--ds-line); border-radius: var(--ds-r-sm); color: var(--ds-navy); font-size: var(--ds-fs-sm); padding: 6px 8px; }
body.skin-billdr #app .tc-code-nametext { color: var(--ds-ink); font-size: var(--ds-fs-sm); }
body.skin-billdr #app #view-templates .tc-code-newacts .btn { min-height: 34px; padding: 0 12px; font-size: var(--ds-fs-sm); }

/* selections */
body.skin-billdr #app .tc-subrow > td { background: var(--ds-tint); }
body.skin-billdr #app .tc-sel-items li { border-bottom-color: var(--ds-hair); font-size: var(--ds-fs-sm); }
body.skin-billdr #app .tc-sel-allow { color: var(--ds-muted); font-size: var(--ds-fs-sm); }
body.skin-billdr .tc-imp-warn { color: var(--ds-warn-ink); }

/* wave54-fix (2026-10-22) — C3: the Products list at Billdr
 * proportions: large photo thumbnails, roomier rows, larger
 * name/price text (the owner: the list was "too small to see"). */
body.skin-billdr #app .tc-table.tc-prods td { padding: 16px 14px; font-size: 15px; }
body.skin-billdr #app .tc-table.tc-prods .tc-prod-name { font-size: 17px; font-weight: 600; color: var(--ds-navy); }
body.skin-billdr #app .tc-table.tc-prods .tc-num { font-size: 15px; }
body.skin-billdr #app .tc-table.tc-prods .dw4-prod-thumb { width: 56px; height: 56px; border-radius: 8px; }
body.skin-billdr #app .tc-table.tc-prods .tc-prod-thumb-ph { display: inline-flex; width: 56px; height: 56px; border-radius: 8px; margin-right: 10px; vertical-align: middle; align-items: center; justify-content: center; background: var(--ds-fill); border: 1px solid var(--ds-hair); color: var(--ds-muted); }
