/* CIS & Invoice Tool — additions to the shared quote styles (../job-quote-calculator/quote.css) */

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* Selects share the look of the text inputs */
.quote-field-group select,
.inv-line select {
  width: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 10px;
}
.quote-field-group select:focus,
.inv-line select:focus,
.inv-line input:focus { outline: none; border-color: var(--accent); }

.cis-saved-note { margin: 0; font-size: 13px; color: var(--text-muted); }
.cis-saved-note a { color: var(--accent); text-decoration: underline; }

/* Line items: description on its own row, then type / qty / price / amount */
.inv-lines { display: flex; flex-direction: column; }
.inv-line {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) 26px;
  grid-template-areas: "desc desc desc remove" "type type type type" "qty price amount amount";
  gap: 6px 8px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.inv-line:first-child { border-top: none; padding-top: 0; }
.inv-line input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 9px;
}
.inv-line select { font-size: 13.5px; padding: 8px 8px; }
.inv-line-desc { grid-area: desc; }
.inv-line-type { grid-area: type; }
.inv-line-qty { grid-area: qty; }
.inv-line-price { grid-area: price; }
.inv-line-amount {
  grid-area: amount;
  font-family: var(--font-head); font-weight: 700; font-size: 14px;
  color: var(--text); text-align: right; padding-right: 2px;
}
.inv-line .quote-line-remove { grid-area: remove; }

/* Hints under the VAT / CIS selects */
.cis-hints { display: flex; flex-direction: column; gap: 8px; }
.cis-hints:empty { display: none; }
.cis-hint {
  margin: 0; padding: 10px 12px; font-size: 13px; line-height: 1.45;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  color: var(--text-secondary); background: var(--bg);
}
.cis-hint-warn { border-color: #C77D17; color: var(--text); }
.cis-hint-info { border-color: var(--accent); }

/* Invoice preview additions */
.quote-preview .qp-totals { max-width: 440px; }
.qp-totals-row span:first-child { padding-right: 16px; }
.qp-totals-row.inv-sub { font-size: 13px; color: var(--text-muted); padding: 3px 0; }
.qp-totals-row.inv-net { border-top-width: 1px; }
.inv-type-tag {
  display: inline-block; margin-left: 8px; padding: 1px 8px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--text-muted); border: 1px solid var(--border); border-radius: 999px;
}

/* Saved invoices */
.cis-saved, .cis-guide { max-width: 1080px; margin: 20px auto 0; }
.cis-saved-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; margin-bottom: 18px;
}
.cis-saved-head h2, .cis-guide h2 { font-size: 22px; margin: 0; }
.cis-saved-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.cis-year { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: end; margin-bottom: 20px; }
.cis-year-pick { min-width: 190px; }
.cis-year-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px; margin: 0; flex: 1;
}
.cis-stat {
  padding: 12px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-md); background: var(--bg);
}
.cis-stat dt { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.cis-stat dd { margin: 0; font-family: var(--font-head); font-size: 20px; font-weight: 700; color: var(--text); }

.cis-table-wrap { overflow-x: auto; }
.cis-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.cis-table th {
  text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-muted); padding: 8px 8px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.cis-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); color: var(--text-secondary); vertical-align: middle; }
.cis-table .num { text-align: right; white-space: nowrap; }
.cis-table tr.is-editing td { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.cis-status-select {
  font-family: var(--font-body); font-size: 13px; padding: 5px 8px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.cis-status-paid { border-color: #2E7D4F; color: #2E7D4F; }
.cis-status-sent { border-color: var(--accent); }
.cis-row-actions { white-space: nowrap; text-align: right; }
.cis-link-btn {
  background: none; border: none; padding: 4px 6px; font: inherit; font-size: 13px;
  color: var(--accent); cursor: pointer; text-decoration: underline;
}
.cis-link-btn:hover { color: var(--text); }
.cis-empty { color: var(--text-muted); font-size: 14px; margin: 0 0 14px; }
.cis-saved .cis-saved-note { margin-top: 14px; }

/* Guidance */
.cis-guide h2 { margin-bottom: 14px; }
.cis-guide details { border-top: 1px solid var(--border); padding: 12px 0; }
.cis-guide summary { cursor: pointer; font-weight: 600; color: var(--text); }
.cis-guide details p { margin: 12px 0 0; font-size: 14.5px; line-height: 1.6; color: var(--text-secondary); }
.cis-guide details a, .cis-guide .cis-saved-note a { color: var(--accent); text-decoration: underline; }
.cis-guide > .cis-saved-note { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 14px; }

.cis-terms { max-width: 50%; }

@media (max-width: 480px) {
  .cis-year-pick { min-width: 100%; }
  .cis-terms { max-width: none; }
}

/* Example mode (?example): start the layout higher so the invoice fits in a screenshot */
.cis-example .quote-intro { display: none; }
.cis-example .quote-shell { padding-top: 4px; }
.cis-example .quote-layout { margin-top: 0; gap: 16px; }
.cis-example .quote-preview-card { padding-top: 14px; padding-bottom: 14px; }
.cis-example .qp-totals { margin-top: 6px; }
.cis-example .qp-totals-row.inv-total { padding-top: 6px; padding-bottom: 6px; }
.cis-example .quote-preview-header { margin-bottom: 10px; padding-bottom: 10px; }
.cis-example .qp-header { margin-bottom: 14px; padding-bottom: 12px; }
.cis-example .qp-client { margin-bottom: 10px; }
.cis-example .qp-table { margin-bottom: 8px; }
.cis-example .qp-table td { padding: 6px; }
.cis-example .qp-totals-row { padding: 3px 0; }
.cis-example .qp-totals-row.inv-sub { display: none; }
/* the example is reverse charged, so "Net total" repeats "Invoice total": drop it to save height */
.cis-example .qp-totals-row:nth-last-child(5) { display: none; }

@media print {
  .cis-saved, .cis-guide { display: none !important; }
}
