/* InvoiceGo free invoice generator. Shares tokens with style.css. */
.gen-hero { background: linear-gradient(160deg, #ecfdf5, #f7f8fa 60%); padding: 36px 0 20px; }
.gen-hero h1 { font-size: clamp(30px, 4.5vw, 44px); margin-bottom: 8px; }
.gen-hero .lead { max-width: 760px; margin: 0; }

.gen { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 28px; align-items: start; padding-top: 24px; }
.gen-side { position: sticky; top: 78px; }

/* Form */
.gen-form fieldset { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 16px 6px; margin: 0 0 14px; min-width: 0; }
.gen-form legend { font-weight: 700; padding: 0 6px; }
.gen-form label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.gen-form input, .gen-form select, .gen-form textarea {
  display: block; width: 100%; margin-top: 4px; font: inherit; font-size: 15px; color: var(--ink);
  border: 1px solid #d1d5db; border-radius: 10px; padding: 9px 11px; background: #fff;
}
.gen-form textarea { resize: vertical; }
.gen-form input:focus, .gen-form select:focus, .gen-form textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.seg { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 4px; margin-bottom: 14px; }
.seg button { border: 0; background: none; font: inherit; font-weight: 600; padding: 8px 18px; border-radius: 999px; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--brand); color: #fff; }
.logo-row { display: flex; align-items: center; gap: 12px; }
.file input { padding: 7px; }
.link { border: 0; background: none; color: var(--brand); font: inherit; font-size: 14px; cursor: pointer; padding: 0; }

.item { display: grid; grid-template-columns: minmax(0, 1fr) 70px 110px 34px; gap: 8px; align-items: end; margin-bottom: 8px; }
.item label { margin: 0; }
.item .del { height: 40px; border: 1px solid var(--line); background: #fff; border-radius: 10px; cursor: pointer; color: var(--muted); font-size: 18px; }
.item .del:hover { color: #b91c1c; border-color: #fca5a5; }
.btn-ghost { border: 1px dashed var(--brand); background: #fff; color: var(--brand); font: inherit; font-weight: 600; border-radius: 10px; padding: 9px 14px; cursor: pointer; margin: 4px 0 12px; }
.disc { max-width: 360px; }

/* Actions */
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.actions .btn { margin: 0; border: 0; cursor: pointer; font: inherit; font-weight: 600; padding: 12px 20px; }
.actions .btn-ghost { margin: 0; }
.btn-wa { background: #1fa855; }
.btn-wa:hover { background: #178a45; }
.hint { width: 100%; margin: 0; }

/* Document (A4 proportions) */
.paper-wrap { background: #e5e7eb; border-radius: 14px; padding: 14px; }
.paper { background: #fff; aspect-ratio: 210 / 297; width: 100%; box-shadow: 0 10px 30px rgba(15, 23, 42, .12);
  padding: 6.5%; font-size: clamp(8px, 1.05vw, 12px); line-height: 1.45; color: #111827; display: flex; flex-direction: column; }
.d-head { background: var(--brand); color: #fff; border-radius: 1em; padding: 1.4em 1.6em; display: flex; justify-content: space-between; gap: 1.5em; align-items: flex-start; }
.d-from { display: flex; gap: 1em; align-items: flex-start; min-width: 0; }
.d-logo { width: 4.6em; height: 4.6em; object-fit: contain; background: #fff; border-radius: .6em; padding: .25em; flex: none; }
.d-biz { font-size: 1.45em; font-weight: 800; line-height: 1.2; }
.d-sub { opacity: .9; white-space: pre-line; }
.d-title { text-align: right; flex: none; }
.d-title b { display: block; font-size: 1.8em; letter-spacing: .12em; }
.d-meta { display: grid; grid-template-columns: 1fr auto; gap: 2em; margin: 1.8em 0 1.4em; }
.d-label { font-size: .8em; letter-spacing: .1em; text-transform: uppercase; color: #6b7280; font-weight: 700; }
.d-client b { font-size: 1.15em; }
.d-dates { text-align: right; }
.d-dates div { margin-bottom: .2em; }
.d-table { width: 100%; border-collapse: collapse; }
.d-table th { text-align: left; font-size: .8em; letter-spacing: .08em; text-transform: uppercase; color: #6b7280; border-bottom: 2px solid #111827; padding: .6em .4em; }
.d-table td { border-bottom: 1px solid #e5e7eb; padding: .7em .4em; vertical-align: top; }
.d-table .n { text-align: right; white-space: nowrap; }
.d-empty { color: #9ca3af; font-style: italic; }
.d-totals { margin-left: auto; width: 52%; margin-top: 1em; }
.d-totals div { display: flex; justify-content: space-between; padding: .35em .4em; }
.d-totals .grand { background: #ecfdf5; color: var(--brand-d); font-weight: 800; font-size: 1.25em; border-radius: .5em; padding: .6em .6em; margin-top: .3em; }
.d-paid { margin-top: .6em; text-align: right; }
.d-paid span { display: inline-block; border: .18em solid var(--brand); color: var(--brand); border-radius: .4em; padding: .2em .8em; font-weight: 800; letter-spacing: .1em; transform: rotate(-3deg); }
.d-notes { margin-top: 1.6em; display: grid; gap: 1em; }
.d-notes p { margin: .2em 0 0; white-space: pre-line; }
.d-foot { margin-top: auto; padding-top: 1.2em; text-align: center; color: #9ca3af; font-size: .85em; border-top: 1px solid #e5e7eb; }
.d-foot b { color: var(--brand); }

/* Promo + SEO content */
.promo { margin-top: 40px; }
.promo-card { background: #fff; border: 2px solid var(--brand); border-radius: 16px; padding: 24px; display: flex; gap: 20px; align-items: flex-start; }
.promo-card img { border-radius: 14px; flex: none; }
.promo-card h2 { margin: 0 0 6px; font-size: 22px; }
.promo-card p { margin: 0 0 12px; color: #4b5563; }
.seo ol { padding-left: 20px; }
.seo li { margin-bottom: 6px; }
.seo details { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin-bottom: 8px; }
.seo summary { font-weight: 600; cursor: pointer; }
.seo details p { margin: 8px 0 0; color: #4b5563; }

@media (max-width: 900px) {
  .gen { grid-template-columns: 1fr; }
  .gen-side { position: static; }
  .paper { font-size: clamp(6.5px, 2.15vw, 12px); }
}
@media (max-width: 520px) {
  .row2, .row3 { grid-template-columns: 1fr; }
  .item { grid-template-columns: 1fr 64px 96px 34px; }
  .promo-card { flex-direction: column; }
}

/* Print / Save as PDF: only the document, at true A4 size. */
@page { size: A4; margin: 0; }
@media print {
  html, body { background: #fff !important; }
  .no-print, .actions { display: none !important; }
  .gen { display: block; padding: 0; max-width: none; }
  .gen-side { position: static; }
  .paper-wrap { background: none; padding: 0; border-radius: 0; }
  /* min-height, not height: long documents continue onto page 2 instead of being cut off. */
  .paper { width: 210mm; min-height: 296mm; aspect-ratio: auto; box-shadow: none; padding: 14mm; font-size: 10.5pt; }
  .d-table tr, .d-totals, .d-notes { break-inside: avoid; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
