:root { color-scheme: light; }
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #1c2834;
  background: #f4f7f8;
  line-height: 1.45;
}
.portal-bar {
  display: flex; gap: 12px; align-items: center;
  background: #12324f; color: #fff; padding: 14px 20px;
}
.portal-bar img { width: 56px; height: 56px; object-fit: contain; flex: 0 0 auto; }
.portal-bar span { display: block; color: #c5d4e4; font-size: 0.85rem; }
.portal { max-width: 820px; margin: 0 auto; padding: 24px 16px 48px; }
.kicker { letter-spacing: 0.08em; text-transform: uppercase; color: #5c6b7a; font-size: 0.78rem; margin: 0; }
h1 { margin: 4px 0 8px; font-size: 1.8rem; }
h2 { margin: 0 0 8px; }
.status { color: #12324f; font-weight: 700; }
.sheet {
  background: #fff; border: 1px solid #e1e8ee; border-radius: 12px;
  padding: 18px; margin-top: 16px;
}
/* Bill to | work address | dates. Addresses are street, then "City, NB E4P 2M5" (AddressFormat);
   columns never overlap and words are not split. The work column is left out when it is the
   billing address (.who-2). */
.who { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px 32px; align-items: start; }
.who p { margin: 0 0 4px; word-break: normal; overflow-wrap: break-word; hyphens: manual; }
.who .label { margin-bottom: 4px; }
.who .addr { line-height: 1.5; }
.nobr { white-space: nowrap; }
@media (min-width: 560px) {
  .who { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .who:not(.who-2) .who-dates { grid-column: 1 / -1; }
}
@media (min-width: 760px) {
  .who { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) max-content; column-gap: 28px; }
  .who.who-2 { grid-template-columns: minmax(0, 1fr) max-content; }
  .who .who-dates, .who:not(.who-2) .who-dates { grid-column: auto; text-align: right; }
}
.label { color: #5c6b7a; font-size: 0.85rem; }
table { width: 100%; border-collapse: collapse; margin-top: 16px; }
th { text-align: left; font-size: 0.75rem; letter-spacing: 0.05em; text-transform: uppercase; color: #5c6b7a; border-bottom: 2px solid #12324f; padding: 6px 4px; }
td { border-bottom: 1px solid #e8eef3; padding: 8px 4px; vertical-align: top; }
.sums { margin: 16px 0 0 auto; max-width: 360px; }
.sums div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.sums .due { background: #12324f; color: #fff; padding: 8px 10px; border-radius: 8px; margin-top: 6px; }
.notes { white-space: pre-wrap; }
.ghost { color: #12324f; font-weight: 700; }
.row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
label { display: block; font-weight: 650; margin: 10px 0 4px; }
input {
  width: 100%; min-height: 44px; border: 1px solid #c5d0da; border-radius: 8px;
  padding: 8px 10px; font: inherit; font-size: 16px;
}
.pay-btn {
  margin-top: 14px; width: 100%; min-height: 48px; border: 0; border-radius: 8px;
  background: #1f8a4c; color: #fff; font-weight: 750; font-size: 1rem; cursor: pointer;
}
.banner { background: #eef3f8; border-radius: 8px; padding: 10px 12px; }
.banner.ok { background: #e5f6ec; }
.banner.bad { background: #fdecea; color: #7a1f16; }
.banner[hidden] { display: none; }
.legal { margin-top: 18px; padding-top: 12px; border-top: 1px solid #e4ebf1; font-size: 0.85rem; color: #5c6b7a; }
.portal-invite { margin-top: 22px; padding: 16px 18px; background: #fff; border: 1px solid #dde3e9; border-radius: 8px; }
.portal-invite h2 { margin: 0 0 6px; font-size: 1rem; color: #12324f; }
.portal-invite p { margin: 0 0 8px; }
.portal-invite a { color: #b8202b; font-weight: 700; }
.legal p { margin: 0 0 4px; }

/* Status line with the PAID / PARTIALLY PAID / VOID stamp and the Print / Download PDF button. */
.doc-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 12px; }
.doc-head .status { margin: 0; }
.paid-stamp {
  display: inline-flex; flex-direction: column; align-items: center; margin: 6px 0;
  color: #c4161c; border: 4px double #c4161c; border-radius: 8px; padding: 4px 16px 5px;
  transform: rotate(-4deg); background: #fff;
}
.paid-stamp .stamp-word { font-size: 1.9rem; font-weight: 800; letter-spacing: 0.14em; line-height: 1.1; }
.paid-stamp .stamp-sub { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em; }
.paid-stamp.stamp-partial .stamp-word { font-size: 1.15rem; letter-spacing: 0.07em; }
.paid-stamp.stamp-void { color: #7a1f16; border-color: #7a1f16; }
.print-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 16px;
  border: 2px solid #12324f; border-radius: 8px; color: #12324f; background: #fff;
  font-weight: 700; text-decoration: none;
}
.print-btn.primary { background: #12324f; color: #fff; }
.print-btn:focus-visible, .thanks-link:focus-visible { outline: 3px solid #f0b429; outline-offset: 2px; }
.thanks-link { display: inline-block; margin-left: 6px; color: #1f6b3a; font-weight: 700; }
.receipt h2 { font-size: 1.15rem; }
.paytbl th.num, .paytbl td.num { text-align: right; white-space: nowrap; }
.paytbl td.ref { overflow-wrap: anywhere; }
.sums .due.zero { background: #1f6b3a; }
.paid-note { color: #1f6b3a; font-weight: 700; margin: 12px 0 0; }
.paid-note.partial { color: #12324f; }
.receipt-actions { margin: 14px 0 0; }
@media (max-width: 520px) {
  .doc-head .print-btn, .receipt-actions .print-btn { width: 100%; }
  .paytbl th, .paytbl td { font-size: 0.85rem; padding: 6px 3px; }
}

/* Browser printing: just the invoice, the stamp and the payments. */
@media print {
  @page { margin: 14mm; }
  body { background: #fff; font-size: 11pt; }
  .portal-bar { background: #fff; color: #1c2834; padding: 0 0 8px; border-bottom: 2px solid #b8202b; }
  .portal-bar span { color: #5c6b7a; }
  .portal { max-width: none; padding: 8px 0 0; }
  .sheet { border: 0; border-radius: 0; padding: 0; margin-top: 12px; }
  .who { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) max-content; }
  .who.who-2 { grid-template-columns: minmax(0, 1fr) max-content; }
  .who .who-dates, .who:not(.who-2) .who-dates { grid-column: auto; text-align: right; }
  .pay, .print-btn, .receipt-actions, .banner, .thanks-link, #pay-error { display: none !important; }
  .paid-stamp { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sums .due { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .receipt, table, .sums { break-inside: avoid; page-break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}

/* Payment receipt page (/r/{token}). */
.paid-stamp.stamp-received { color: #1f6b3a; border-color: #1f6b3a; }
.paid-stamp.stamp-received .stamp-word { font-size: 1.5rem; }
.rc { margin-top: 0; }
.rc td { padding: 9px 4px; }
.rc td.v { text-align: right; overflow-wrap: anywhere; }
.rc tr.strong td { font-weight: 700; color: #12324f; }
.rc-notes { margin-top: 12px; color: #3c4a57; font-size: 0.92rem; }
.rc-notes p { margin: 0 0 6px; }
.rc-thanks { margin-top: 18px; font-weight: 700; color: #12324f; }
.lang-switch { color: #12324f; text-transform: none; letter-spacing: 0; font-weight: 700; }
@media print {
  .lang-switch { display: none; }
  .paid-stamp.stamp-received { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Card on file page (/autopay/{token}) */
.autopay .card-fee-note { background: #eef3f8; border-radius: 8px; padding: 10px 12px; margin: 0 0 16px; }
.autopay .autopay-plans td:last-child, .autopay .autopay-plans th:last-child { text-align: right; white-space: nowrap; }
.autopay .consent-h { margin: 18px 0 6px; font-size: 1rem; }
.autopay .consent-text { max-height: 260px; overflow-y: auto; background: #f7fafc; border: 1px solid #dbe4ec; border-radius: 8px; padding: 10px 12px; font-size: 0.9rem; line-height: 1.5; }
.autopay .consent-check { display: flex; gap: 10px; align-items: flex-start; font-weight: 650; margin: 12px 0 0; }
.autopay .consent-check input { width: 22px; height: 22px; min-height: 0; flex: 0 0 auto; margin-top: 1px; }
.autopay .billing { border: 0; margin: 16px 0 0; padding: 0; min-width: 0; }
.autopay .billing legend { font-weight: 750; font-size: 1rem; padding: 0; margin: 0 0 2px; }
.autopay .billing .label { margin: 0 0 4px; }
.autopay .addr-row { display: grid; grid-template-columns: 2fr 1.4fr 1fr; gap: 8px; }
.autopay select {
  width: 100%; min-height: 44px; border: 1px solid #c5d0da; border-radius: 8px;
  padding: 8px 10px; font: inherit; font-size: 16px; background: #fff; color: inherit;
}
.autopay [aria-invalid="true"] { border-color: #b3261e; box-shadow: 0 0 0 1px #b3261e; }
.autopay .field-err { color: #7a1f16; font-size: 0.85rem; margin: 4px 0 0; }
@media (max-width: 560px) {
  .autopay .addr-row { grid-template-columns: 3fr 2fr; }
  .autopay .addr-row .addr-city { grid-column: 1 / -1; }
}
.portal-bar .ap-lang { display: flex; gap: 4px; margin-left: auto; flex: 0 0 auto; }
.portal-bar .ap-lang a { color: #c5d4e4; text-decoration: none; font-weight: 700; font-size: 0.85rem; padding: 6px 8px; border-radius: 6px; }
.portal-bar .ap-lang a[aria-current="true"] { background: #fff; color: #12324f; }
.portal-bar .ap-lang a:focus-visible { outline: 3px solid #f0b429; outline-offset: 2px; }
.enroll-facts { display: grid; gap: 10px; margin: 0; }
.enroll-facts div { display: grid; grid-template-columns: 9.5rem 1fr; gap: 8px; align-items: baseline; }
.enroll-facts dt { margin: 0; color: #5c6b7a; }
.enroll-facts dd { margin: 0; }
.enroll-pick { border: 0; margin: 16px 0; padding: 0; display: grid; gap: 8px; }
.enroll-pick legend { font-weight: 750; margin-bottom: 4px; }
.enroll-pick label { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid #dbe4ec; border-radius: 10px; background: #fff; }
.enroll-pick input { width: 22px; height: 22px; min-height: 0; flex: 0 0 auto; margin-top: 2px; }
/* Payment choice: bold title, description on its own line beneath it. */
.enroll-pick label > span { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.enroll-pick label > span > .label { display: block; font-weight: 400; line-height: 1.4; }
.enroll [data-method-panel][hidden] { display: none; }
@media (max-width: 560px) {
  .enroll-facts div { grid-template-columns: 1fr; gap: 2px; }
}
.sig-wrap { position: relative; margin: 6px 0 8px; }
.sig-pad {
  display: block; width: 100%; height: 180px; background: #fff; border: 2px dashed #9fb0c0; border-radius: 10px;
  touch-action: none; cursor: crosshair;
}
.sig-pad.signed { border-style: solid; border-color: #12324f; }
.sig-clear {
  margin: 0 0 12px; min-height: 44px; background: #fff; border: 1px solid #c5d0da;
  border-radius: 8px; padding: 8px 14px; font: inherit;
}
.enroll .consent-text { max-height: 16rem; overflow: auto; }
.layouts { margin-top: 12px; }
.layout-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.layout-list .print-btn { display: inline-flex; }

/* Invoice pay: bank or card, stacked for a phone. */
.pay-choices { display: grid; gap: 10px; margin: 12px 0; }
.pay-choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%;
  min-height: 48px; padding: 12px 14px; text-align: left; cursor: pointer;
  border: 2px solid #dbe3ea; border-radius: 10px; background: #fff; color: #12324f; font: inherit;
}
.pay-choice strong { font-size: 1.05rem; }
.pay-choice small { color: #5c6b7a; font-size: 0.88rem; line-height: 1.35; }
.pay-choice[aria-pressed="true"] { border-color: #12324f; background: #f3f7fb; }
.pay-choice:focus-visible { outline: 3px solid #f0b429; outline-offset: 2px; }
.pay-panel { margin-top: 8px; }
.pay-panel[hidden] { display: none; }
.fee-line, .fee-total { margin: 8px 0; }
.fee-total { font-weight: 700; }
.bank-row { grid-template-columns: 1fr 1fr; }
.pad-terms {
  max-height: 180px; overflow: auto; margin: 10px 0; padding: 10px 12px; background: #fff;
  border: 1px solid #dbe3ea; border-radius: 8px; font-size: 0.85rem; color: #33414f;
}
.pad-terms p { margin: 0; }
.pad-terms:focus-visible { outline: 3px solid #f0b429; outline-offset: 2px; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; margin: 12px 0 4px; }
label.check input { width: 22px; min-height: 22px; height: 22px; margin: 2px 0 0; flex: 0 0 auto; }
.funding { border: 0; margin: 8px 0 0; padding: 0; }
.funding legend { font-weight: 750; padding: 0; }
.field-err { color: #7a1f16; font-size: 0.88rem; margin: 4px 0 0; font-weight: 650; }
.banner.wait { background: #fff4e0; color: #5b3a00; }

/* Interac e-Transfer line on the invoice pay card */
.etransfer-line { margin: 12px 0 4px; padding: 10px 12px; background: #f3f5f7; border-left: 3px solid #12324f; border-radius: 4px; line-height: 1.5; }
.etransfer-line strong { word-break: break-all; }
.etransfer-line small { color: #5c6b7a; }
