/* ==========================================================================
   18-licensereport.css — THE SOFTWARE LICENCE REGISTER, ON PAPER

   "the PDF of the report should output and format similar to" — and the
   example he sent was the ProPresenter Alpha Keying guide, one of the two
   books this app ships.

   So this report is NOT the app wearing a print stylesheet. It is a
   document: landscape, cream ground, navy ink, gold rules, a dark cover with
   a title block and a strip of figures, a running head on every page and a
   page number in the corner. The same furniture the books use, because that
   is the house style he asked for.

   WHY REAL PAGE ELEMENTS RATHER THAN LETTING THE TABLE FLOW

   A browser cannot write a page number into a running footer: there is no
   CSS counter for pages that Chrome will honour, and the @page margin boxes
   that would do it are not implemented. The books get their numbers because
   headless Chromium is given a footer template, which is not available to a
   page printing itself.

   So the report builds its own pages. Each .licrep-page is exactly one sheet
   -- 11in by 8.5in, the landscape letter box -- with its own head, its own
   foot and its own number, and `break-after: page` after it. What is on
   screen is therefore what comes out, sheet for sheet, which is also what
   makes the preview worth looking at.

   THE COLOURS ARE WRITTEN OUT, NOT TAKEN FROM THE THEME

   Every other report in this app follows whichever theme is on. This one
   does not, deliberately: it is a document that will be sent to somebody,
   filed, or handed to an accountant, and it has to look the same whoever
   printed it and whatever colour scheme they happen to be using that week.
   The values below are the books' own.
   ========================================================================== */

.licrep {
  /* The books' palette, by name so the rest of this file reads plainly. */
  --lr-paper:  #f4f1ea;   /* the cream sheet                      */
  --lr-ink:    #1f2d4a;   /* the navy everything is written in    */
  --lr-mute:   #5e6e88;   /* captions, second lines, units        */
  --lr-gold:   #b8912f;   /* kickers, rules, the number you scan  */
  --lr-hair:   #d9d3c4;   /* the thin separators                  */
  --lr-cover:  #16213a;   /* the cover ground                     */
  --lr-red:    #a8322c;   /* expired                              */
  --lr-amber:  #9a6b14;   /* nearly due                           */
  --lr-green:  #2f6b45;   /* in date                              */

  background: #30363f;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

/* ---- one sheet ----------------------------------------------------------- */
.licrep-page {
  width: 11in;
  height: 8.5in;
  box-sizing: border-box;
  background: var(--lr-paper);
  color: var(--lr-ink);
  padding: 0.5in 0.6in 0.45in;
  display: flex;
  flex-direction: column;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 11px;
  line-height: 1.5;
  position: relative;
  overflow: hidden;
  /* On screen only — on paper the sheet IS the paper and a shadow would
     print as a grey smear down two edges. Removed in the print block. */
  box-shadow: 0 6px 24px rgba(0, 0, 0, .45);
}

/* ---- the running head ---------------------------------------------------- */
.licrep-head {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 1.5px solid var(--lr-gold);
  padding-bottom: 7px; margin-bottom: 16px;
  flex: 0 0 auto;
}
.licrep-head-l {
  font-size: 9px; font-weight: 700; letter-spacing: 1.4px;
  text-transform: uppercase; color: var(--lr-gold);
}
.licrep-head-r { font-size: 9px; color: var(--lr-mute); letter-spacing: .3px; }

/* ---- the running foot ---------------------------------------------------- */
.licrep-foot {
  display: flex; justify-content: space-between; align-items: baseline;
  border-top: 1px solid var(--lr-hair);
  padding-top: 7px; margin-top: auto;
  flex: 0 0 auto;
}
.licrep-foot-l { font-size: 8.5px; color: var(--lr-mute); letter-spacing: .3px; }
.licrep-foot-n { font-size: 9px; font-weight: 700; color: var(--lr-ink); }

.licrep-body { flex: 1 1 auto; min-height: 0; overflow: hidden; }

/* ---- the cover ----------------------------------------------------------- */
.licrep-page.is-cover {
  background: var(--lr-cover);
  color: #ffffff;
  padding: 1.1in 1in;
  justify-content: space-between;
}
.licrep-cover-rule { width: 220px; height: 5px; background: var(--lr-gold); }
.licrep-cover-kicker {
  font-size: 11px; font-weight: 700; letter-spacing: 3px;
  text-transform: uppercase; color: var(--lr-gold); margin-top: 26px;
}
.licrep-cover-title {
  font-size: 54px; font-weight: 800; line-height: 1.05;
  letter-spacing: -1px; margin-top: 14px; color: #ffffff;
}
.licrep-cover-sub {
  font-size: 15px; line-height: 1.5; color: #c8d2e2;
  margin-top: 16px; max-width: 7.2in;
}
.licrep-cover-for {
  font-size: 13px; font-weight: 700; color: #ffffff; margin-top: 22px;
}

/* The strip of figures under the rule — the books' own device, and the
   right one here: four numbers that say what this register is before
   anybody turns a page. */
.licrep-stats {
  display: flex; gap: 46px; flex-wrap: wrap;
  border-top: 1px solid rgba(255, 255, 255, .28);
  padding-top: 14px; margin-top: 26px;
}
.licrep-stat-k {
  font-size: 8.5px; font-weight: 700; letter-spacing: 1.4px;
  text-transform: uppercase; color: #9fb0c8;
}
.licrep-stat-v { font-size: 14px; font-weight: 700; color: #ffffff; margin-top: 3px; }
.licrep-cover-foot {
  font-size: 9px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: #8fa0b8;
}

/* ---- a section opener ---------------------------------------------------- */
.licrep-page.is-part { justify-content: center; align-items: center; text-align: center; }
.licrep-part-k {
  font-size: 11px; font-weight: 700; letter-spacing: 3.5px;
  text-transform: uppercase; color: var(--lr-gold);
}
.licrep-part-t { font-size: 40px; font-weight: 800; margin-top: 10px; letter-spacing: -.5px; }
.licrep-part-s { font-size: 14px; color: var(--lr-mute); margin-top: 10px; max-width: 6in; }

/* ---- an entry heading ---------------------------------------------------- */
.licrep-entry { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 16px; }
.licrep-entry-n {
  font-size: 34px; font-weight: 800; color: var(--lr-hair);
  line-height: 1; flex: 0 0 auto; min-width: 44px;
}
.licrep-entry-t { font-size: 23px; font-weight: 700; letter-spacing: -.3px; }
.licrep-entry-s { font-size: 12.5px; font-weight: 600; color: var(--lr-mute); margin-top: 4px; }

/* ---- the register table -------------------------------------------------- */
.licrep-table { width: 100%; border-collapse: collapse; font-size: 10px; }
.licrep-table th {
  text-align: left; font-size: 8px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--lr-gold);
  border-bottom: 1px solid var(--lr-hair); padding: 0 8px 6px 0;
}
.licrep-table td {
  padding: 7px 8px 7px 0; vertical-align: top;
  border-bottom: 1px solid var(--lr-hair);
}
.licrep-table tr:last-child td { border-bottom: none; }
.licrep-t-num  { color: var(--lr-mute); font-variant-numeric: tabular-nums; width: 30px; }
.licrep-t-name { font-weight: 700; }
.licrep-t-sub  { display: block; font-weight: 400; color: var(--lr-mute); font-size: 9px; margin-top: 1px; }
.licrep-t-date { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.licrep-t-num-cell { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.licrep-t-card { font-family: 'Courier New', monospace; letter-spacing: .5px; white-space: nowrap; }
.licrep-dim    { color: var(--lr-mute); }

.licrep-is-overdue { color: var(--lr-red); }
.licrep-is-soon    { color: var(--lr-amber); }
.licrep-is-ok      { color: var(--lr-green); }

.licrep-tag {
  display: inline-block; font-size: 8px; font-weight: 700; letter-spacing: .6px;
  text-transform: uppercase; padding: 1.5px 6px; border-radius: 2px;
  border: 1px solid currentColor; white-space: nowrap;
}

/* ---- the marker boxes, straight out of the books ------------------------- */
.licrep-marker {
  border-left: 3px solid var(--lr-gold);
  background: rgba(184, 145, 47, .10);
  padding: 9px 12px; margin-top: 12px;
}
.licrep-marker.is-watch { border-left-color: var(--lr-red); background: rgba(168, 50, 44, .08); }
.licrep-marker.is-real  { border-left-color: var(--lr-mute); background: rgba(94, 110, 136, .08); }
.licrep-marker-k {
  font-size: 8.5px; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--lr-gold); margin-bottom: 4px;
}
.licrep-marker.is-watch .licrep-marker-k { color: var(--lr-red); }
.licrep-marker.is-real  .licrep-marker-k { color: var(--lr-mute); }
.licrep-marker p { margin: 0; font-size: 11px; line-height: 1.55; }

/* ---- two columns, the books' own page shape ------------------------------ */
.licrep-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; height: 100%; }
.licrep-col { min-width: 0; }
.licrep-colhead {
  font-size: 8.5px; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--lr-gold); margin-bottom: 7px;
}

/* ---- one licence, in full ------------------------------------------------ */
.licrep-cards { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.licrep-lcard {
  border: 1px solid var(--lr-hair); border-top: 3px solid var(--lr-gold);
  padding: 11px 13px; break-inside: avoid;
}
.licrep-lcard.is-overdue { border-top-color: var(--lr-red); }
.licrep-lcard.is-soon    { border-top-color: var(--lr-amber); }
.licrep-lcard-t { font-size: 14px; font-weight: 700; line-height: 1.25; }
.licrep-lcard-v { font-size: 10px; color: var(--lr-mute); margin-top: 2px; }
.licrep-dl { margin-top: 9px; }
.licrep-dl-row { display: flex; gap: 8px; font-size: 9.5px; padding: 2.5px 0; border-bottom: 1px solid var(--lr-hair); }
.licrep-dl-row:last-child { border-bottom: none; }
.licrep-dt {
  flex: 0 0 82px; font-size: 8px; font-weight: 700; letter-spacing: .7px;
  text-transform: uppercase; color: var(--lr-gold); padding-top: 1px;
}
.licrep-dd { flex: 1 1 auto; min-width: 0; word-break: break-word; }

/* ---- the figures page ---------------------------------------------------- */
.licrep-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.licrep-tile { border: 1px solid var(--lr-hair); border-left: 3px solid var(--lr-gold); padding: 11px 13px; }
.licrep-tile-k {
  font-size: 8px; font-weight: 700; letter-spacing: 1.1px;
  text-transform: uppercase; color: var(--lr-mute);
}
.licrep-tile-v { font-size: 27px; font-weight: 800; margin-top: 4px; line-height: 1; }
.licrep-tile-s { font-size: 9px; color: var(--lr-mute); margin-top: 4px; }
.licrep-tile.is-overdue { border-left-color: var(--lr-red); }
.licrep-tile.is-overdue .licrep-tile-v { color: var(--lr-red); }
.licrep-tile.is-soon { border-left-color: var(--lr-amber); }
.licrep-tile.is-soon .licrep-tile-v { color: var(--lr-amber); }

/* A bar chart drawn with two divs, because a picture of a chart would be a
   picture and this has to stay crisp at print resolution. */
.licrep-bars { display: flex; flex-direction: column; gap: 7px; }
.licrep-bar-row { display: flex; align-items: center; gap: 10px; font-size: 10px; }
.licrep-bar-k { flex: 0 0 150px; color: var(--lr-ink); }
.licrep-bar-track { flex: 1 1 auto; height: 13px; background: rgba(94, 110, 136, .13); position: relative; }
.licrep-bar-fill { position: absolute; inset: 0 auto 0 0; background: var(--lr-gold); }
.licrep-bar-fill.is-overdue { background: var(--lr-red); }
.licrep-bar-fill.is-soon    { background: var(--lr-amber); }
.licrep-bar-fill.is-ok      { background: var(--lr-green); }
.licrep-bar-v { flex: 0 0 34px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* The line above the report on screen, which never prints: how to get the
   cover to run to the edge of the sheet. */
.licrep-hint {
  background: #1f2937; color: #cbd5e1; font-size: 11px; line-height: 1.6;
  border: 1px solid #3b4758; border-radius: 6px; padding: 10px 14px;
  max-width: 11in; width: 100%; box-sizing: border-box;
}
.licrep-hint strong { color: #fcd34d; }


/* ==========================================================================
   ON PAPER

   Everything that is not the report goes; the dialog stops being a floating
   box and becomes the document; and the sheets, which are already exactly
   one page each, are told to break after themselves.
   ========================================================================== */
body.printing-licenses {
  background: #f4f1ea !important;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}
body.printing-licenses #editor-screen,
body.printing-licenses #landing-screen,
body.printing-licenses #side-panel,
body.printing-licenses #side-panel-overlay,
body.printing-licenses #roster-dock-btn,
body.printing-licenses #options-dock-btn,
body.printing-licenses #options-panel,
body.printing-licenses #options-panel-overlay,
body.printing-licenses #calendar-overlay,
body.printing-licenses #ao,
body.printing-licenses .toolbar,
body.printing-licenses .licrep-hint,
body.printing-licenses [data-xp-parked] {
  display: none !important;
}
body.printing-licenses #mo {
  display: block !important;
  position: static !important;
  background: #f4f1ea !important;
  width: 100% !important;
  height: auto !important;
  overflow: visible !important;
  box-shadow: none !important;
  border: none !important;
  padding: 0 !important;
  z-index: auto !important;
}
body.printing-licenses #mo .modal-box,
body.printing-licenses #mo .modal-body {
  width: 100% !important;
  max-width: 100% !important;
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
  box-shadow: none !important;
  border: none !important;
  border-radius: 0 !important;
  background: #f4f1ea !important;
  padding: 0 !important;
}
body.printing-licenses #mo .modal-header,
body.printing-licenses #mo .modal-foot-wrap,
body.printing-licenses #mo .modal-footer,
body.printing-licenses #mo button {
  display: none !important;
}
body.printing-licenses .licrep { padding: 0 !important; gap: 0 !important; background: #f4f1ea !important; }
body.printing-licenses .licrep-page {
  box-shadow: none !important;
  break-after: page;
  break-inside: avoid;
}
body.printing-licenses .licrep-page:last-child { break-after: auto; }

@media print {
  .licrep { padding: 0 !important; gap: 0 !important; background: #f4f1ea !important; }
  .licrep-hint { display: none !important; }
  .licrep-page {
    box-shadow: none !important;
    break-after: page;
    break-inside: avoid;
  }
  .licrep-page:last-child { break-after: auto; }
}
