/* Invoice detail page: a printable document, not an app screen. Built to
   .ui-spec/docs/prototype/invoice-detail.html + styles.css's ".cp-sheet"
   rules — the client's 2026-07-24 invoice mockup — deliberately opting out
   of card chrome and setting its own type scale, since the page itself is
   the artifact (see app/views/pages/invoice/detail.js).

   Adapted from the mockup's own CSS rather than copied verbatim: its
   `--cp-leader` (dotted-rule color) and `--cp-shadow-menu` (sheet shadow)
   are bespoke tokens this app doesn't have — using --bs-secondary-color and
   .card's existing box-shadow value instead of introducing new ones. */

.cp-invoice-sheet {
  max-width: 760px;
  margin: 0 auto;
  padding: 3.5rem 3.25rem;
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  box-shadow: 0 1px 2px rgb(0 0 0 / 8%), 0 4px 12px rgb(0 0 0 / 10%);
  font-size: .8125rem;
  line-height: 1.45;
}

/* The stacked/squarer lockup (#cp-logo-vertical in public/images/cp-logo.svg,
   ported from .ui-spec's logo-vertical.svg), not #cp-logo's wide horizontal
   one used by the sidebar/login page — matches the mockup's proportions. */
.cp-invoice-mark {
  display: block;
  width: 104px;
  height: auto;

  /* The artwork inside cp-logo-vertical's 194x200 viewBox has ~21px (at this
     rendered size) of empty space above the ink before the mark actually
     starts — measured by rasterizing and scanning for the first non-white
     row. Without this, align-items-start on the letterhead lines up the
     mark's and the store block's boxes, but the store text's own ink sits
     visibly higher than the mark's. */
  margin-top: -21px;
  color: var(--bs-primary);
}

.cp-invoice-store {
  font-style: normal;
  text-align: right;
  line-height: 1.5;
}

/* INVOICE# is the largest thing on the page after the mark (mockup). */
.cp-invoice-number {
  margin-top: .25rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.cp-invoice-meta { margin-top: 1.5rem; }

/* Dotted rules under the header row and between line items — the mockup's separator. */
.cp-invoice-table {
  width: 100%;
  margin-top: 2.5rem;
  border-collapse: collapse;

  & th,
  & td {
    padding-left: 1rem;
    border-bottom: 1px dotted var(--bs-secondary-color);
  }

  & td {
    padding-top: .55rem;
    padding-bottom: .65rem;
    vertical-align: top;
  }

  & th:first-child,
  & td:first-child {
    padding-left: 0;
  }
}

.cp-invoice-th {
  padding-bottom: .35rem;
  font-weight: 400;
  text-align: left;
  white-space: nowrap; /* "Total Price" must not wrap to two lines */
}

/* The pieces the purchase order and the store order pick list add to the
   sheet: a document title above the number, a right-aligned column of
   figures (after .cp-invoice-th, which it overrides on a heading), and a
   banner said on the sheet itself, in the ink colour, so it survives a black
   and white print. */
.cp-invoice-title {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.15;
}

.cp-invoice-num {
  text-align: right;
  white-space: nowrap;
}

.cp-invoice-banner {
  margin-bottom: 1.75rem;
  padding: .5rem .75rem;
  border: 1.5px solid currentcolor;
  font-weight: 600;
  text-align: center;
}

/* The mockup left-aligns Qty / Price / Total Price rather than right-aligning
   the money. Fixed widths keep the columns off the description and stop
   them drifting row to row. */
.cp-invoice-qty { width: 56px; }
.cp-invoice-amt { width: 96px; }

/* Priority / Due Date / Condition sit under the description, indented (mockup). */
.cp-invoice-sub {
  margin-top: .15rem;
  padding-left: 1.25rem;
  font-size: .75rem;

  & div { margin-top: .05rem; }
}

/* A long Condition wraps and hangs under its own label rather than under the date line. */
.cp-invoice-cond {
  padding-left: 1.1rem;
  text-indent: -1.1rem;
}

.cp-invoice-total {
  display: flex;
  justify-content: flex-end;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.cp-invoice-disclaimer {
  margin-top: 2.75rem;
  font-size: .6875rem;
  font-style: italic;
  line-height: 1.5;
}

/* On screen, the shadow + centered max-width read as a page floating on a
   canvas. Printed, the sheet IS the page — the shadow would just double up
   with the paper's own edge, and the auto margin + the sheet's own padding
   would double up with the browser/printer's own page margins. Drop all
   three so print output isn't over-indented on top of already-blank paper. */
@media print {
  .cp-invoice-sheet {
    max-width: none;
    margin: 0;
    padding: 0;
    box-shadow: none;
  }
}
