@page {
  size: Letter;
  margin: 0;
}

:root {
  color: #202326;
  background: #ececea;
  font-family: "Brandon Grotesque", "Avenir Next", Avenir, "Helvetica Neue", Arial, sans-serif;
  font-size: 10pt;
  font-weight: 400;
  letter-spacing: 0.008em;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.invoice-page a:link,
.invoice-page a:visited {
  color: inherit;
  text-decoration: none;
}

.invoice-page a:active {
  text-decoration: underline;
}

.invoice-page,
.invoice-page * {
  outline: 1px solid rgb(255 0 0 / 45%);
}

.print-preview {
  padding: 0.35in;
}

.print-toolbar {
  display: flex;
  justify-content: space-between;
  width: 8.5in;
  margin: 0 auto 0.2in;
}

.print-toolbar a,
.print-toolbar button {
  padding: 0.08in 0.14in;
  color: #202326;
  background: #ffffff;
  border: 1px solid #c9cbc9;
  border-radius: 0;
  font: inherit;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-decoration: none;
  cursor: pointer;
}

.invoice-page {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 8.5in;
  min-height: 11in;
  margin: 0 auto;
  padding: 0.6in 0.65in;
  background: #ffffff;
  overflow: hidden;
}

.invoice-page > :not(.document-background) {
  position: relative;
  z-index: 1;
}

.document-background {
  position: absolute;
  z-index: 0;
  bottom: 0;
  left: 50%;
  width: 160%;
  height: auto;
  opacity: 0.4;
  transform: translateX(-50%);
  pointer-events: none;
}

.document-header {
  display: block;
}

.document-header-primary,
.document-header-details {
  display: flex;
  justify-content: space-between;
  gap: 0.4in;
}

.document-header-primary {
  align-items: end;
}

.document-header-details {
  align-items: start;
}

.brand-logo {
  display: block;
  width: 2.65in;
  height: auto;
}

.brand-address {
  min-width: 2.65in;
  margin-top: 0.12in;
  color: #686b6d;
  font-size: 8pt;
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0.025em;
  line-height: 1.55;
  text-align: right;
}

.brand-address span,
.brand-address a {
  display: block;
}

.brand-address a {
  color: inherit;
  text-decoration: none;
}

.invoice-heading {
  text-align: left;
}

.document-header-primary h1 {
  margin: 0;
  font-family: "Cormorant Garamond", "Iowan Old Style", Baskerville, Georgia, serif;
  font-size: 25pt;
  font-weight: 500;
  letter-spacing: 0.015em;
  line-height: 0.8;
}

.invoice-number {
  margin: 0.08in 0 0;
  color: #4f5355;
  font-size: 9pt;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.header-metadata {
  margin: 0.16in 0 0;
}

.header-metadata div {
  margin-top: 0.06in;
}

.header-metadata dt,
.header-metadata dd {
  display: inline;
  margin: 0;
}

.header-metadata dt {
  color: #777a7c;
  font-size: 7pt;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-metadata dd {
  margin-left: 0.04in;
  font-size: 8.5pt;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.document-summary {
  margin-top: 0.35in;
}

.document-summary h2,
.document-notes h2,
.payment-details h2 {
  margin: 0 0 0.1in;
  color: #6d7072;
  font-size: 7pt;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.payment-details h2 {
  color: #676a6c;
  font-size: 9pt;
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1.2;
}

.bill-to address {
  font-style: normal;
  color: #3b3e40;
  font-size: 9pt;
  letter-spacing: 0.015em;
  line-height: 1.6;
}

.bill-to address > span,
.bill-to address > strong {
  display: block;
}

.bill-to address > strong {
  color: #202326;
  font-size: 10.5pt;
  font-weight: 500;
  letter-spacing: 0.025em;
}

.bill-to address p {
  margin: 0;
}

.purchase-order {
  margin-top: 0.08in;
}

.line-items {
  margin-top: 0.45in;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  display: table-header-group;
}

th {
  padding: 0.08in 0.05in;
  color: #343739;
  border-bottom: 2px solid #343739;
  font-size: 7pt;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-align: left;
  text-transform: uppercase;
}

td {
  padding: 0.13in 0.05in;
  border-bottom: 1px solid #e4e4e1;
  color: #343739;
  font-size: 9pt;
  line-height: 1.45;
  vertical-align: top;
}

.line-title {
  display: block;
  margin-top: 0.04in;
  font-weight: 500;
  letter-spacing: 0.012em;
}

.invoice-line {
  break-inside: avoid;
  page-break-inside: avoid;
}

.line-date {
  display: block;
  color: #777a7c;
  font-size: 7.5pt;
  letter-spacing: 0.025em;
}

.line-value {
  display: block;
}

.has-service-date .line-value {
  margin-top: 0.17in;
}

.numeric {
  text-align: right;
  white-space: nowrap;
}

.quantity-column {
  width: 0.55in;
  padding-right: 0.03in;
  padding-left: 0.03in;
  text-align: center;
  white-space: nowrap;
}

.money-column {
  width: 1.05in;
  padding-right: 0.03in;
  padding-left: 0.03in;
}

.document-totals {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.5in;
  margin-top: auto;
  padding-top: 0.25in;
  padding-bottom: 0.75in;
  break-inside: avoid;
  page-break-inside: avoid;
}

.document-totals dl {
  flex: 0 0 2.5in;
  width: 2.5in;
  margin: 0 0 0 auto;
}

.document-totals > dl > div {
  display: flex;
  justify-content: space-between;
  gap: 0.2in;
  padding: 0 0 0.06in;
}

.document-totals dt {
  color: #676a6c;
  font-size: 9pt;
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
}

.document-totals dd {
  margin: 0;
  color: #292c2e;
  font-size: 10pt;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.document-totals .grand-total {
  margin-top: 0.04in;
  padding-top: 0.1in;
  border-top: 2px solid #343739;
}

.document-totals .grand-total dt,
.document-totals .grand-total dd {
  color: #202326;
  font-size: 12pt;
  font-weight: 600;
}

.document-details {
  display: flex;
  flex-direction: column;
  gap: 0.2in;
  max-width: 3.75in;
}

.payment-details,
.document-notes {
  color: #707375;
  font-size: 8pt;
  letter-spacing: 0.025em;
  line-height: 1.6;
}

.payment-details p,
.document-notes p {
  margin: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media screen and (max-width: 9.2in) {
  .print-preview {
    overflow-x: auto;
  }
}

@media print {
  /* Revisit renderer-specific margin handling when PDF4.dev is introduced. */
  :root,
  body {
    background: #ffffff;
  }

  .print-preview {
    padding: 0;
  }

  .print-toolbar {
    display: none !important;
  }

  .invoice-page {
    min-height: 10.95in;
    margin: 0;
    border: 0;
    box-shadow: none;
  }
}
