/* ToolbeltDocs Invoice Generator — extras on top of estimate-maker.css (which styles the
   shared layout, form, preview and buttons for both tools). Scoped under #tbd-invoice-generator. */

/* ---------- Change orders and payments rows ---------- */
#tbd-invoice-generator .tbe-co,
#tbd-invoice-generator .tbe-pay {
  display: grid;
  gap: 6px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--tbe-line-2);
}
#tbd-invoice-generator .tbe-co {
  grid-template-columns: 90px minmax(0, 1fr) auto;
}
#tbd-invoice-generator .tbe-co > .tbe-input:nth-child(2) {
  grid-column: 2 / -1;
}
#tbd-invoice-generator .tbe-co > .tbe-input:nth-child(3),
#tbd-invoice-generator .tbe-co > .tbe-input:nth-child(4) {
  grid-column: span 1;
}
#tbd-invoice-generator .tbe-pay {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
}
#tbd-invoice-generator .tbe-pay > .tbe-input:first-child {
  grid-column: 1 / -1;
}
@container tbdform (min-width: 560px) {
  #tbd-invoice-generator .tbe-co {
    grid-template-columns: 80px minmax(0, 1fr) 150px 110px auto auto;
  }
  #tbd-invoice-generator .tbe-co > .tbe-input:nth-child(2) {
    grid-column: auto;
  }
  #tbd-invoice-generator .tbe-pay {
    grid-template-columns: minmax(0, 1fr) 160px 130px auto;
  }
  #tbd-invoice-generator .tbe-pay > .tbe-input:first-child {
    grid-column: auto;
  }
}

/* ---------- Quick-add chips ---------- */
#tbd-invoice-generator .tbe-quickadd {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}
#tbd-invoice-generator .tbe-addchips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
#tbd-invoice-generator .tbe-addchip.tbe-addchip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 6px 12px;
  margin: 0;
  border: 1px dashed var(--tbe-line);
  border-radius: 999px;
  background: var(--tbe-card);
  color: var(--tbe-navy);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-align: left;
}
#tbd-invoice-generator .tbe-addchip.tbe-addchip:hover,
#tbd-invoice-generator .tbe-addchip.tbe-addchip:focus-visible {
  border-style: solid;
  border-color: var(--tbe-navy);
  background: var(--tbe-navy-soft);
}

/* ---------- Pre-send checklist ---------- */
#tbd-invoice-generator .tbe-checks {
  list-style: none;
  margin: 8px 0 12px;
  padding: 0;
}
#tbd-invoice-generator .tbe-checks li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 0;
  border-bottom: 1px solid var(--tbe-line-2);
  font-size: 15px;
}
#tbd-invoice-generator .tbe-checks__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
}
#tbd-invoice-generator .tbe-checks li.is-ok .tbe-checks__mark {
  background: var(--tbe-ok-soft);
  color: var(--tbe-ok);
}
#tbd-invoice-generator .tbe-checks li.is-todo .tbe-checks__mark {
  background: var(--tbe-warn-soft);
  color: var(--tbe-warn);
}
#tbd-invoice-generator .tbe-checks__text {
  flex: 1 1 220px;
}
#tbd-invoice-generator .tbe-checks li.is-ok .tbe-checks__text {
  color: var(--tbe-ink-2);
}
#tbd-invoice-generator .tbe-checks__act {
  font-size: 14px;
}
#tbd-invoice-generator .tbe-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Status badges + owed summary ---------- */
#tbd-invoice-generator .tbe-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  vertical-align: middle;
  white-space: nowrap;
}
#tbd-invoice-generator .tbe-badge--muted { background: var(--tbe-line-2); color: var(--tbe-ink-2); }
#tbd-invoice-generator .tbe-badge--info { background: var(--tbe-navy-soft); color: var(--tbe-navy); }
#tbd-invoice-generator .tbe-badge--warn { background: var(--tbe-warn-soft); color: var(--tbe-warn); }
#tbd-invoice-generator .tbe-badge--ok { background: var(--tbe-ok-soft); color: var(--tbe-ok); }
#tbd-invoice-generator .tbe-badge--error { background: var(--tbe-err-soft); color: var(--tbe-err); }
#tbd-invoice-generator .tbe-owed {
  margin: 0 0 8px;
  padding: 10px 12px;
  border-radius: var(--tbe-radius-sm);
  background: var(--tbe-warn-soft);
  border: 1px solid var(--tbe-warn-line);
  font-size: 14px;
}
#tbd-invoice-generator .tbe-fu__acts {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
#tbd-invoice-generator .tbe-due {
  font-weight: 600;
  color: var(--tbe-navy);
  margin-top: 6px;
}
#tbd-invoice-generator .tbe-recent--pick li {
  padding: 8px 0;
}

/* ---------- Preview extras ---------- */
#tbd-invoice-generator .tbe-doc {
  position: relative;
}
#tbd-invoice-generator .tbe-doc__parties--3 {
  grid-template-columns: 1fr 1fr 1.1fr;
}
#tbd-invoice-generator .tbe-doc__duebox {
  padding: 8px 10px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--doc-brand, #1e3a5f) 9%, #fff);
  border-top: 3px solid var(--doc-brand, #1e3a5f);
}
#tbd-invoice-generator .tbe-doc--bold .tbe-doc__duebox {
  background: #ffedd5;
  border-top-color: var(--doc-accent, #ea580c);
}
#tbd-invoice-generator .tbe-doc__dueamt {
  font-size: 17px;
  font-weight: 800;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}
#tbd-invoice-generator .tbe-doc__paidnote {
  color: #15803d;
  font-weight: 700;
}
#tbd-invoice-generator .tbe-doc__trow--due {
  margin-top: 3px;
  padding-top: 5px;
  border-top: 2px solid var(--doc-brand, #1e3a5f);
  color: var(--doc-brand, #1e3a5f);
  font-size: 13px;
}
#tbd-invoice-generator .tbe-doc--bold .tbe-doc__trow--due {
  background: #ffedd5;
  color: #9a3412;
  padding-left: 4px;
  padding-right: 4px;
}
#tbd-invoice-generator .tbe-doc__trow--total {
  border-top: 1px solid var(--tbe-line);
}
#tbd-invoice-generator .tbe-doc__link {
  color: var(--doc-brand, #1e3a5f);
  text-decoration: underline;
  word-break: break-all;
}
#tbd-invoice-generator .tbe-doc__thanks {
  margin-top: 14px;
  font-style: italic;
  color: var(--doc-brand, #1e3a5f);
}
#tbd-invoice-generator .tbe-doc__stamp {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-25deg);
  font-size: 96px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: rgba(21, 128, 61, 0.18);
  border: 8px solid rgba(21, 128, 61, 0.18);
  padding: 0 24px;
  border-radius: 12px;
  pointer-events: none;
}

/* Lines copied from an estimate: say so, and keep suggestions out of the way */
#tbd-invoice-generator .tbe-copied {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--tbe-ok-soft);
  color: var(--tbe-ok);
  font-weight: 600;
  font-size: 14px;
}
#tbd-invoice-generator .tbe-copied svg {
  vertical-align: -3px;
}
#tbd-invoice-generator .tbe-quickmore {
  margin-top: 14px;
}
#tbd-invoice-generator .tbe-quickmore > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--tbe-navy);
  min-height: 44px;
  display: flex;
  align-items: center;
}
#tbd-invoice-generator .tbe-quickmore[open] > summary {
  margin-bottom: 8px;
}
