/* Harpoon free tools: invoice builder. Scoped to .hp-inv so custom.css never
   styles the tool. Page-section styles live in tools-pages.css. Base font
   size on the site is 10px, so 1.6rem = 16px. */
.hp-inv { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; max-width: 1140px; margin: 0 auto; font-size: 1.6rem; color: #222; }
.hp-inv * { box-sizing: border-box; }
@media (max-width: 900px) { .hp-inv { grid-template-columns: minmax(0, 1fr); } }
.hp-inv__form, .hp-inv__preview-wrap, .hp-inv__group, .hp-inv__field, .hp-inv__cell { min-width: 0; }

/* Form */
.hp-inv__group { background: #fff; border: 1px solid #e4e4e4; border-radius: 6px; padding: 16px; margin-bottom: 16px; }
.hp-inv__group-title { font-size: 1.7rem; margin: 0 0 12px; color: #222; }
.hp-inv__field { display: block; margin: 0 0 12px; font-weight: 400; }
.hp-inv__label { display: block; font-size: 1.3rem; color: #555; margin-bottom: 4px; }
.hp-inv__input, .hp-inv__textarea, .hp-inv__select { width: 100%; font: inherit; font-size: 1.5rem; padding: 8px 10px; border: 1px solid #d5d5d5; border-radius: 4px; background: #fff; color: #222; margin: 0; }
.hp-inv__input:focus, .hp-inv__textarea:focus, .hp-inv__select:focus { outline: none; border-color: #1bbdf6; box-shadow: 0 0 0 3px rgba(27,189,246,.2); }
.hp-inv__textarea { min-height: 70px; resize: vertical; }
.hp-inv__row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.hp-inv__inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hp-inv__inline .hp-inv__select { width: auto; }
.hp-inv__file { font-size: 1.4rem; max-width: 100%; width: 100%; }
.hp-inv__items { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.hp-inv__items th { text-align: left; font-size: 1.2rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #8e8e8e; padding: 4px 6px; }
.hp-inv__cell { padding: 4px 6px; vertical-align: middle; }
.hp-inv__input--num { max-width: 96px; }
.hp-inv__cell--amount { font-weight: 700; white-space: nowrap; text-align: right; }
.hp-inv__cell--remove { width: 36px; text-align: center; }
.hp-inv__remove { border: 0; background: transparent; color: #8e8e8e; font-size: 2rem; line-height: 1; cursor: pointer; padding: 2px 6px; }
.hp-inv__remove:hover { color: #ff5722; }
.hp-inv__link { border: 0; background: transparent; color: #8e8e8e; font: inherit; font-size: 1.4rem; cursor: pointer; text-decoration: underline; padding: 0; }
.hp-inv__btn { font: inherit; font-size: 1.5rem; font-weight: 700; padding: 10px 18px; border-radius: 4px; border: 1px solid #1bbdf6; background: #1bbdf6; color: #fff; cursor: pointer; }
.hp-inv__btn:hover { background: #1ab6ed; }
.hp-inv__btn--secondary { background: #fff; color: #1bbdf6; }
.hp-inv__btn--secondary:hover { background: #f0fbff; }
.hp-inv__actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 12px; }
.hp-inv__note { font-size: 1.3rem; color: #8e8e8e; margin: 0 0 6px; }
.hp-inv__error { font-size: 1.3rem; color: #ff5722; margin: 4px 0 0; }
.hp-inv__error:empty { display: none; }
.hp-inv__swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.hp-inv__swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #c9c9c9; padding: 0; cursor: pointer; }
.hp-inv__swatch[aria-checked="true"] { box-shadow: 0 0 0 2px #222; }
.hp-inv__swatch:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(27,189,246,.6); }
.hp-print-root { display: none; }

/* Preview: the "paper" */
.hp-inv__preview-wrap { position: sticky; top: 20px; align-self: start; }
.hp-inv__preview-label { font-size: 1.2rem; text-transform: uppercase; letter-spacing: .05em; color: #8e8e8e; margin-bottom: 8px; }
.hp-inv__paper { background: #fff; border: 1px solid #e4e4e4; box-shadow: 0 6px 24px rgba(0,0,0,.08); padding: 36px; font-size: 1.4rem; line-height: 1.5; color: #222; min-height: 500px; overflow-wrap: break-word; }
.hp-inv__head { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.hp-inv__logo { display: block; max-width: 180px; max-height: 80px; width: auto; height: auto; margin-bottom: 10px; }
.hp-inv__name { font-weight: 700; font-size: 1.6rem; }
.hp-inv__meta { text-align: right; }
.hp-inv__title { font-size: 2.8rem; font-weight: 700; letter-spacing: .08em; color: var(--hp-accent, #1bbdf6); margin-bottom: 6px; line-height: 1.2; }
.hp-inv__meta-list { display: grid; grid-template-columns: auto auto; gap: 2px 12px; margin: 0; justify-content: end; }
.hp-inv__meta-list dt { color: #8e8e8e; margin: 0; }
.hp-inv__meta-list dd { margin: 0; font-weight: 700; }
.hp-inv__section-label { font-size: 1.2rem; text-transform: uppercase; letter-spacing: .05em; color: #8e8e8e; margin-bottom: 2px; }
.hp-inv__to { margin-bottom: 24px; }
.hp-inv__ptable { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.hp-inv__ptable th { text-align: left; font-size: 1.2rem; text-transform: uppercase; letter-spacing: .04em; color: #fff; background: var(--hp-accent, #1bbdf6); padding: 8px; }
.hp-inv__ptable td { padding: 8px; border-bottom: 1px solid #eef0f2; vertical-align: top; }
.hp-inv__ptable td:empty::after { content: '\00a0'; }
.hp-inv__num { text-align: right; white-space: nowrap; }
.hp-inv__totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; max-width: 320px; margin: 0 0 24px auto; }
.hp-inv__totals dt { margin: 0; color: #555; text-align: right; }
.hp-inv__totals dd { margin: 0; font-weight: 700; text-align: right; }
.hp-inv__grand { font-size: 1.8rem; color: #34d789; border-top: 2px solid #222; padding-top: 6px; }
.hp-inv__ph { color: #b5b5b5; }
.hp-inv__notes { font-size: 1.3rem; color: #555; }

/* Phone: form rows stack, line items become labelled cards */
@media (max-width: 640px) {
  .hp-inv__row { grid-template-columns: minmax(0, 1fr); }
  .hp-inv__paper { padding: 20px; }
  .hp-inv__head { flex-direction: column; }
  .hp-inv__meta { text-align: left; }
  .hp-inv__meta-list { justify-content: start; }
  .hp-inv__preview-wrap { position: static; }
  .hp-inv__items thead { display: none; }
  .hp-inv__items, .hp-inv__items tbody, .hp-inv__items tr, .hp-inv__items td { display: block; width: 100%; }
  .hp-inv__item { display: grid !important; grid-template-columns: 1fr 1fr; gap: 6px 10px; padding: 8px 0; border-bottom: 1px solid #e4e4e4; }
  .hp-inv__item td:first-child { grid-column: 1 / 3; }
  .hp-inv__cell::before { content: attr(data-title); display: block; font-size: 1.2rem; color: #8e8e8e; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
  .hp-inv__cell--remove::before { content: none; }
  .hp-inv__cell--amount { text-align: left; }
  .hp-inv__cell--remove { text-align: right; }
  .hp-inv__input--num { max-width: none; }
  .hp-inv__ptable th, .hp-inv__ptable td { padding: 6px 4px; font-size: 1.2rem; }
  .hp-inv__num { white-space: normal; }
}

/* Template pages: the download block above the builder */
.hp-templates { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 32px; max-width: 960px; margin: 0 auto 40px; align-items: center; }
@media (max-width: 767px) { .hp-templates { grid-template-columns: 1fr; } }
.hp-templates__preview { border: 1px solid #e4e4e4; box-shadow: 0 6px 24px rgba(0,0,0,.08); background: #fff; }
.hp-templates__preview img { display: block; width: 100%; height: auto; }
.hp-templates h2 { font-size: 2.4rem; margin: 0 0 8px; }
.hp-templates p { font-size: 1.6rem; color: #555; }
.hp-templates__buttons { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 8px; }
.hp-templates__btn { display: inline-block; font-size: 1.5rem; font-weight: 700; padding: 12px 20px; border-radius: 4px; background: #1bbdf6; color: #fff !important; text-decoration: none !important; }
.hp-templates__btn:hover { background: #1ab6ed; }
.hp-templates__note { font-size: 1.3rem; color: #8e8e8e; margin: 0; }
.hp-inv-or { text-align: center; font-size: 2.2rem; margin: 0 0 16px; }

/* Print: only the invoice preview, at page width. Everything else is
   display:none (not visibility:hidden) so no blank trailing pages. */
@media print {
  @page { margin: 8mm; }
  header, footer, .hero, .cta-prompt, .hp-copy-section, .faq-section, .cross-links-section,
  .hp-templates, .hp-inv-or, .hp-inv__form, .hp-inv__preview-label, noscript,
  #stcm-wrapper, [id^="silktide"], [class^="silktide"] { display: none !important; }
  body { background: #fff !important; }
  .bg-waves, .bg-gradient-top, .bg-gradient-bottom, .hp-tool-section, .hp-tool-section .container, .hp-inv, .hp-inv__preview-wrap {
    display: block !important; background: none !important; padding: 0 !important; margin: 0 !important; max-width: none !important; width: auto !important; position: static !important;
  }
  .hp-inv__paper, .hp-inv__paper * { box-sizing: border-box; }
  .hp-inv__paper { box-shadow: none; border: 0; padding: 28px; max-width: none; width: auto; min-height: 0; font-size: 12pt; }
  .hp-inv__ptable th { background: var(--hp-accent, #1bbdf6) !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .hp-inv__title { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  /* When the engine has cloned the preview to the end of <body>, print only that clone. */
  body.hp-printing > *:not(.hp-print-root) { display: none !important; }
  body.hp-printing .hp-print-root { display: block !important; position: static; width: auto; }
  .hp-inv__ph { color: #999; }
}
