/* New/edit invoice composition recovered from the selected Stitch editor.
   All inputs and mutations remain owned by the existing invoice controller. */
.tv-stitch-invoice-editor {
  --invoice-editor-ink: var(--tv-text, #15221f);
  --invoice-editor-muted: var(--tv-text-muted, #5d6b67);
  --invoice-editor-line: var(--tv-border, #d5e0da);
  --invoice-editor-paper: var(--tv-surface, #fff);
  --invoice-editor-canvas: var(--tv-bg, #f4f7f5);
  --invoice-editor-brand: var(--tv-brand, #073b37);
  --invoice-editor-accent: var(--tv-accent, #f45b17);
  display: block;
  min-width: 0;
  color: var(--invoice-editor-ink);
}
.tv-stitch-invoice-editor-frame[data-route-id="invoice-editor"] > .workspace-hero {padding:0 0 18px;border:0;border-bottom:1px solid var(--tv-border,#d5e0da);border-radius:0;background:transparent;box-shadow:none;}
.tv-stitch-invoice-editor-frame[data-route-id="invoice-editor"] > .workspace-hero h2 {font-size:24px;line-height:1.3;letter-spacing:-.025em;}
.tv-stitch-invoice-editor-frame[data-route-id="invoice-editor"] > .workspace-hero p {font-size:14px;line-height:1.5;}

.tv-stitch-invoice-editor .tv-document-strip {
  display: flex;
  flex-wrap:wrap;
  gap: 12px 28px;
  margin-bottom: 16px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--invoice-editor-line);
}
.tv-stitch-invoice-editor .tv-document-strip > div { min-width: 0; display: flex; align-items:baseline;gap: 8px; }
.tv-stitch-invoice-editor .tv-document-strip span {
  color: var(--invoice-editor-muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .045em;
  text-transform: uppercase;
}
.tv-stitch-invoice-editor .tv-document-strip strong { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }

.tv-invoice-editor-layout:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
  align-items: start;
  gap: 20px;
  min-width: 0;
}
.tv-invoice-editor-primary:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){ display: grid; align-content: start; gap: 16px; min-width: 0; }
.tv-stitch-invoice-editor .field {display:grid;align-content:start;gap:6px;min-width:0;font-size:13px;line-height:1.45;}
.tv-stitch-invoice-editor .field > :is(input,select,textarea),
.tv-stitch-invoice-editor .combo-field > :is(input,select,textarea) {width:100%;min-width:0;min-height:40px;}
.tv-stitch-invoice-editor .customer-picker,
.tv-stitch-invoice-editor .combo-field {min-width:0;position:relative;}
.tv-stitch-invoice-editor .customer-picker-fieldset {display:grid;align-items:start;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;}
.tv-stitch-invoice-editor .selected-customer {display:grid;gap:3px;margin-top:6px;font-size:12px;line-height:1.4;}
.tv-stitch-invoice-editor .selected-customer > span {color:var(--invoice-editor-muted);}
.tv-stitch-invoice-editor .field-help {display:block;font-size:11px;line-height:1.5;color:var(--invoice-editor-muted);margin-top:5px;}
.tv-stitch-invoice-editor .invoice-meta-grid {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;margin-top:18px;}
.tv-stitch-invoice-editor .invoice-meta-grid > .field:last-child {grid-column:1/-1;}
.tv-stitch-invoice-editor .tv-primary-grid > .editor-card {padding:0;border:0;background:transparent;box-shadow:none;}
.tv-stitch-invoice-editor .tv-primary-grid h2 {margin:0 0 18px;font-size:19px;line-height:1.3;}
.tv-stitch-invoice-editor .helper-copy {font-size:12px;line-height:1.5;}
.tv-invoice-editor-primary > [data-invoice-step="customer"]:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)),.tv-invoice-editor-primary > [data-invoice-step="items"]:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)),.tv-invoice-editor-primary > .advanced-invoice-fields:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){
  min-width: 0;
  border: 1px solid var(--invoice-editor-line);
  border-radius: 10px;
  background: var(--invoice-editor-paper);
  box-shadow: none;
}
.tv-invoice-editor-primary > [data-invoice-step="customer"]:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)),.tv-invoice-editor-primary > [data-invoice-step="items"]:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){ padding: 18px; }
.tv-invoice-editor-primary :is(h2, h3):where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){ color: var(--invoice-editor-ink); }
.tv-invoice-editor-primary .helper-copy:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){ color: var(--invoice-editor-muted); }
.tv-invoice-editor-primary .table-scroll:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  border: 1px solid var(--invoice-editor-line);
  border-radius: 8px;
}
.tv-invoice-editor-primary table.edit-lines:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){ min-width: 880px;width:100%;table-layout:fixed;border-collapse:collapse;font-size:13px; }
.tv-invoice-editor-primary table.edit-lines :is(th,td):where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){vertical-align:top;padding:10px;}
.tv-invoice-editor-primary table.edit-lines th:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){font-size:11px;letter-spacing:.02em;}
.tv-invoice-editor-primary table.edit-lines :is(th,td):nth-child(1):where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){width:160px;}
.tv-invoice-editor-primary table.edit-lines :is(th,td):nth-child(3):where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){width:64px;}
.tv-invoice-editor-primary table.edit-lines :is(th,td):nth-child(4):where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){width:120px;}
.tv-invoice-editor-primary table.edit-lines :is(th,td):nth-child(5):where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){width:152px;text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums;}
.tv-invoice-editor-primary table.edit-lines :is(th,td):nth-child(6):where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){width:112px;}
.tv-invoice-editor-primary table.edit-lines :is(input,textarea,select):where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){width:100%;min-width:0;max-width:100%;font-size:13px;}
.tv-invoice-editor-primary table.edit-lines .line-action-group:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){display:flex;gap:4px;}
.tv-invoice-editor-primary table.edit-lines .icon-btn:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){width:28px;min-width:28px;min-height:36px;padding:4px;}
.tv-invoice-editor-primary .invoice-line-extra:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){margin-top:6px;font-size:11px;}
.tv-invoice-editor-primary .invoice-line-extra > summary:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){cursor:pointer;color:var(--invoice-editor-muted);}
.tv-invoice-editor-primary .invoice-line-extra-fields:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){display:grid;gap:10px;margin-top:10px;}
.tv-invoice-editor-primary .invoice-line-extra-fields .field:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){font-size:11px;}
.tv-invoice-editor-primary .section-head:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){display:flex;align-items:start;justify-content:space-between;gap:16px;margin-bottom:12px;}
.tv-invoice-editor-primary .section-head h2:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){margin:4px 0 8px;font-size:19px;}
.tv-invoice-editor-primary .tv-invoice-step-kicker:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){font-size:11px;color:var(--invoice-editor-muted);}
.tv-invoice-editor-primary .invoice-line-toolbar-actions:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){ display: flex; flex-wrap: wrap; gap: 8px; }
.tv-invoice-editor-review:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){ position: sticky; top: 16px; display: grid; gap: 16px; min-width: 0; }
.tv-invoice-editor-checks:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){padding:16px 18px;border:1px solid var(--invoice-editor-line);border-radius:10px;background:var(--invoice-editor-canvas);}
.tv-invoice-editor-checks h2:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){margin:0 0 12px;font-size:15px;line-height:1.3;}
.tv-invoice-editor-checks .health-line:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){display:flex;justify-content:space-between;gap:12px;padding:6px 0;font-size:12px;}
.tv-invoice-editor-checks .health-line > span:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){color:var(--invoice-editor-muted);}
.tv-invoice-editor-checks p:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){margin:12px 0 0;font-size:12px;line-height:1.5;}
.tv-invoice-editor-review .invoice-totals-panel:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--invoice-editor-line);
  border-top: 3px solid var(--invoice-editor-brand);
  border-radius: 10px;
  background: var(--invoice-editor-paper);
  box-shadow: 0 8px 24px rgb(21 34 31 / 6%);
}
.tv-invoice-editor-review .invoice-totals-head:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){ display: grid; gap: 12px; }
.tv-invoice-editor-review .invoice-totals-head h2:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){ margin: 2px 0 4px; font-size: 19px; line-height: 1.25; }
.tv-invoice-editor-review .invoice-totals-head p:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){ margin: 0; font-size: 13px; }
.tv-invoice-editor-review .invoice-review-actions:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){ display: grid; gap: 10px; }
.tv-invoice-editor-review .invoice-review-actions > .btn:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){ width: 100%; }
.tv-invoice-editor-review :is(.invoice-discount-compact,.invoice-internal-totals):where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){border-top:1px solid var(--invoice-editor-line);padding-top:12px;}
.tv-invoice-editor-review :is(.invoice-discount-compact,.invoice-internal-totals) > summary:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){cursor:pointer;color:var(--invoice-editor-muted);font-size:12px;font-weight:600;}
.tv-invoice-editor-review .invoice-discount-compact[open] > :not(summary):where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){margin-top:10px;}
.tv-invoice-editor-review .total-line:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){display:flex;align-items:baseline;justify-content:space-between;gap:12px;padding:7px 0;font-size:13px;}
.tv-invoice-editor-review .total-line > strong:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){text-align:right;white-space:nowrap;font-size:13px;}
.tv-invoice-editor-review .total-line.major:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){margin-top:10px;padding-top:14px;border-top:1px solid var(--invoice-editor-line);font-weight:700;}
.tv-invoice-editor-review .total-line.major > strong:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){font-size:18px;}
.tv-invoice-editor-review .invoice-total-metrics:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){ display: grid; gap: 0; }
.tv-invoice-editor-review .invoice-total-metrics > *:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){ min-width: 0; }
.tv-invoice-editor-review .invoice-total-metrics :is(strong, b):where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){ font-variant-numeric: tabular-nums; }
.tv-invoice-editor-review [data-invoice-total="grand"]:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)),.tv-invoice-editor-review [data-invoice-total="outstanding"]:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){ color: var(--invoice-editor-brand); font-weight: 750; }
.tv-invoice-editor-review .invoice-total-metrics [data-invoice-total="outstanding"]:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){
  margin-top: 8px;
  padding: 12px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--invoice-editor-brand) 8%, white);
}
.tv-stitch-invoice-editor .sticky-save {
  display: grid;
  gap: 8px;
  margin:0;
  padding:12px 0 0;
  border-top:1px solid var(--invoice-editor-line);
}
.tv-stitch-invoice-editor .sticky-save .sticky-save-copy {display:grid;gap:6px;font-size:11px;line-height:1.5;color:var(--invoice-editor-muted);}
.tv-stitch-invoice-editor .sticky-save .btn {width:100%;}

@media (max-width: 1080px) {
  .tv-invoice-editor-layout:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){ grid-template-columns: minmax(0, 1fr) 290px; gap: 14px; }
  .tv-invoice-editor-primary > [data-invoice-step="customer"]:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)),.tv-invoice-editor-primary > [data-invoice-step="items"]:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){ padding: 14px; }
}
@media (max-width: 820px) {
  .tv-invoice-editor-layout:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){ grid-template-columns: minmax(0, 1fr); }
  .tv-invoice-editor-review:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){ position: static; grid-row: 2; }
  .tv-invoice-editor-review .invoice-totals-panel:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){ box-shadow: none; }
}
@media (max-width: 560px) {
  .tv-stitch-invoice-editor .tv-document-strip {gap:8px 16px;}
  .tv-stitch-invoice-editor .customer-picker-fieldset,
  .tv-stitch-invoice-editor .invoice-meta-grid {grid-template-columns:minmax(0,1fr);gap:12px;}
  .tv-invoice-editor-primary > [data-invoice-step="customer"]:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)),.tv-invoice-editor-primary > [data-invoice-step="items"]:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)),.tv-invoice-editor-review .invoice-totals-panel:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){ padding: 12px; }
}
@media (max-width: 820px) {
  .tv-invoice-editor-primary table.edit-lines .icon-btn:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){min-width:36px;min-height:44px;}
  .tv-invoice-editor-primary .section-head:where(:not(.tv-stitch-surface):not(.tv-stitch-surface *):not(.tv-home-v1):not(.tv-home-v1 *)){flex-direction:column;}
}
