/* ==========================================================================
   THE DELIVERY TICKET
   An HTML/CSS recreation of PLANTILLA/ticket.jpeg, laid out on US Letter
   (8.5 x 11 in).

   Every colour and every measurement below was sampled from that artwork.
   The source is 1102 x 1427 px, so image pixels were converted at
   816 / 1102 = 0.7405 to give the CSS pixels used here (96px = 1in).

   This document has its own black-and-yellow identity, separate from the
   navy-and-gold invoice.
   ========================================================================== */

.sheet.dt {
  /* ---- palette sampled from ticket.jpeg ---- */
  --d-black:        #1b1f21;   /* SHIPPING / SHIPMENT bars  (#181b1d..#1e2223) */
  --d-ink:          #141719;   /* DELIVERY TICKET wordmark                     */
  --d-yellow:       #fccb17;   /* rules, diagonal accents                      */
  --d-yellow-pale:  #fee497;   /* DOMESTIC ROUTING bar                         */
  --d-grey-label:   #d8dce0;   /* PHONE / BOOKING NUMBER labels                */
  --d-grey-head:    #c8cccf;   /* items table heading row                      */
  --d-panel:        #eef1f2;   /* delivery details / acknowledgement panels    */
  --d-line:         #a9adb0;   /* box borders                                  */
  --d-line-soft:    #c6cacd;
  --d-foot:         #242829;   /* footer band                                  */
  --d-foot-grey:    #e9ebed;   /* light wedge under the footer tagline         */
  --d-text:         #1b1f21;

  --pad-x: 16px;   /* body margin: artwork content spans sheet x 16..800 */

  /* One .sheet element is one physical US Letter page - the same rule as the
     invoice, so the paginator in docshared.js works unchanged. */
  width: 816px;
  height: 1056px;
  background: #ffffff;
  color: var(--d-text);
  font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 12px;
  line-height: 1.25;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 18px rgba(16, 30, 54, .18);
  overflow: hidden;

  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* ==========================================================================
   HEADER          artwork y 0..300  ->  sheet 0..222
   ========================================================================== */

.dt-head {
  position: relative;
  height: 222px;
  flex: 0 0 auto;
  background: #ffffff;
  overflow: hidden;
}

/* Diagonal flash in the top-left corner: a dark wedge at the very corner with
   a yellow band alongside. Artwork: dark x 0..97, yellow x 98..129 at the top
   edge, both running down-left and fading out near y 135. */
.dt-head__corner {
  position: absolute;
  left: 0;
  top: 0;
  width: 110px;
  height: 100px;
  background: var(--d-yellow);
  clip-path: polygon(73px 0, 96px 0, 0 100px, 0 76px);
}
.dt-head__corner::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 110px;
  height: 100px;
  background: #33373a;
  clip-path: polygon(0 0, 72px 0, 0 100px);
}

/* Soft grey diagonal in the top-right corner. */
.dt-head__wedge {
  position: absolute;
  right: 0;
  top: 0;
  width: 42%;
  height: 100%;
  background: linear-gradient(205deg, #eceef0 0%, rgba(255, 255, 255, 0) 58%);
  clip-path: polygon(40% 0, 100% 0, 100% 100%, 8% 100%);
}

/* Artwork: the logo occupies x 74..632, y 12..284  ->  sheet 55, 9, w 413. */
.dt-head__logo {
  position: absolute;
  left: 55px;
  top: 9px;
  width: 413px;
}
.dt-head__logo img { display: block; width: 100%; height: auto; }

/* Artwork: the right-hand block spans x 732..1074  ->  sheet x 542..795. */
.dt-head__right {
  position: absolute;
  right: 21px;
  top: 12px;
  width: 253px;
  padding-top: 36px;   /* room for the absolutely placed wordmark above */
  text-align: right;
}

/* The artwork sets DELIVERY TICKET in a condensed face: 31px cap height across
   exactly 253px. Segoe UI needs 350px for that, so it is squeezed to 253/350
   horizontally - the same trick the original condensed type achieves. */
.dt-word {
  /* Pinned by its right edge so the un-squeezed text overflows to the LEFT;
     text-align cannot do this, because an inline box wider than its line
     always overflows the end edge instead. */
  position: absolute;
  top: 0;
  right: 0;
  font-size: 42px;
  font-weight: 800;
  line-height: .86;
  letter-spacing: -.6px;
  white-space: nowrap;
  transform: scaleX(.723);
  transform-origin: 100% 50%;
  color: var(--d-ink);
}

/* Artwork: rule y 69..75, the full width of the block. */
.dt-rule {
  height: 5px;
  background: var(--d-yellow);
  margin: 6px 0 5px;
}

.dt-subword {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 3.2px;
  color: #22262a;
}

/* ---- contact block: artwork rows at sheet y 96, 138, 168, 193 ---- */
.dt-contact {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}

.dct {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  text-align: left;
  width: 100%;
  padding-left: 30px;
}

.dct__icon {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  margin-top: 1px;
  fill: var(--d-black);
}
.dct__icon .dct__hole   { fill: #ffffff; }
.dct__icon .dct__stroke { fill: none; stroke: #ffffff; stroke-width: 1.7; }

.dct__text {
  font-size: 13.5px;
  line-height: 1.3;
  color: #1a1e21;
  overflow-wrap: anywhere;
}

/* ==========================================================================
   BODY
   ========================================================================== */

.dt-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  padding: 0 var(--pad-x);
  min-height: 0;
}

/* Blocks keep their natural height so an over-full page really does overflow -
   that is what the paginator measures. Only the spacer absorbs slack. */
.dt-body > * { flex: 0 0 auto; }
.dt-grow     { flex: 1 1 0; min-height: 0; }

.dt-pageno {
  flex: 0 0 auto;
  text-align: right;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.6px;
  color: #6a6a6a;
  padding: 0 2px 3px;
}

/* ---- black section bars -------------------------------------------------- */
/* Artwork: SHIPPING INFORMATION y 306..366 (45px), SHIPMENT ITEMS y 707..756
   (37px) - the second bar is deliberately shorter. */

.dt-bar {
  position: relative;
  height: 45px;
  display: flex;
  align-items: center;
  padding: 0 15px;
  background: var(--d-black);
  color: #ffffff;
  font-size: 23px;
  font-weight: 800;
  letter-spacing: .2px;
  border-radius: 4px 4px 0 0;
  overflow: hidden;
}

/* Yellow diagonal flash at the right-hand end of the bar. Artwork: 27px wide,
   sloping from x 1038..1064 at the top to x 1002..1029 at the bottom. */
.dt-bar__accent {
  position: absolute;
  right: 12px;
  top: 0;
  width: 46px;
  height: 100%;
  background: var(--d-yellow);
  clip-path: polygon(57% 0, 99% 0, 42% 100%, 0 100%);
}

.dt-bar--items {
  height: 37px;
  font-size: 20px;
  margin-top: 11px;
}

/* ---- shipping information card ------------------------------------------ */

.dt-ship { background: #ffffff; }

.dt-ship__body {
  border: 1px solid var(--d-line-soft);
  border-top: 0;
  border-radius: 0 0 4px 4px;
  padding: 10px 11px 12px;
}

.dt-subbar {
  background: var(--d-yellow-pale);
  border: 1px solid #efd98f;
  border-radius: 3px;
  color: var(--d-black);
  font-size: 18px;
  font-weight: 800;
  padding: 7px 12px;
}

.dt-routing {
  margin-top: 9px;
  min-height: 108px;
  background: #ffffff;
  border: 1px solid var(--d-line);
  border-radius: 4px;
  padding: 8px 11px;
  font-size: 12.5px;
  line-height: 1.45;
  white-space: pre-wrap;      /* keeps the line breaks the employee typed */
  overflow-wrap: anywhere;
}

.dt-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 11px;
}

.dt-trio {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 11px;
}

.dt-field__label {
  background: var(--d-grey-label);
  color: var(--d-black);
  font-size: 13px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 2px 2px 0 0;
}

.dt-field__cap {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .2px;
  color: var(--d-black);
  margin-bottom: 4px;
}

.dt-field__box {
  background: #ffffff;
  border: 1px solid var(--d-line);
  border-radius: 3px;
  min-height: 27px;
  padding: 4px 9px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--d-text);
  display: flex;
  align-items: center;
  overflow-wrap: anywhere;
}

/* ---- shipment items table ------------------------------------------------ */
/* Artwork column borders at sheet x 16 / 129 / 691 / 799 across a 783px table,
   and body rows 29px tall. */

.dtbl {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  border: 1px solid var(--d-line);
  border-top: 0;
}

.dtbl th {
  background: var(--d-grey-head);
  color: var(--d-black);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: .2px;
  padding: 7px 8px;
  text-align: center;
  border-right: 1px solid var(--d-line);
}
.dtbl th:last-child { border-right: 0; }

.dtbl__qty   { width: 14.4%; }
.dtbl__desc  { width: 71.8%; }
.dtbl__extra { width: 13.8%; }

.dtbl td {
  height: 29px;
  padding: 5px 9px;
  font-size: 12.5px;
  border-top: 1px solid var(--d-line);
  border-right: 1px solid var(--d-line);
  vertical-align: middle;
  background: #ffffff;
  color: var(--d-text);
}
.dtbl td:last-child { border-right: 0; }

.dtbl .td-qty   { text-align: center; font-weight: 700; }
.dtbl .td-desc  { text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; }
.dtbl .td-extra { text-align: center; }

/* ---- delivery details + acknowledgement ---------------------------------- */

.dt-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 13px;
}

.dt-panel {
  background: var(--d-panel);
  border-radius: 5px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dt-panel__title {
  font-size: 16px;
  font-weight: 800;
  color: var(--d-black);
  padding: 10px 14px 7px;
}

.dt-panel__body {
  padding: 0 14px 13px;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

.dt-pair--tight { margin-top: 2px; gap: 14px; }

.dt-ack {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.48;
  color: #1f2325;
}

.dt-sigline {
  border-top: 1px solid #5f6265;
  margin: 18px 0 5px;
}

.dt-sigcap {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1px;
  color: var(--d-black);
}

/* ---- thank you ----------------------------------------------------------- */

.dt-thanks {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 4px 11px;
}

.dt-thanks__dash {
  flex: 1 1 auto;
  height: 5px;
  background: var(--d-yellow);
}

.dt-thanks__text {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 3.6px;
  color: var(--d-black);
  white-space: nowrap;
}

/* ==========================================================================
   FOOTER BAND     artwork y 1309..1427  ->  sheet y 969..1056, 87px tall
   The left half is a light wedge carrying the tagline in dark type; a yellow
   diagonal separates it from the dark right half carrying the website.
   ========================================================================== */

.dt-foot {
  position: relative;
  flex: 0 0 auto;
  height: 87px;
  background: var(--d-foot-grey);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 21px 0 47px;
  overflow: hidden;
}

/* Dark block on the right. Artwork: its left edge runs from sheet x 478 at the
   top of the band to x 431 at the bottom. */
.dt-foot__shape {
  position: absolute;
  inset: 0;
  background: var(--d-foot);
  clip-path: polygon(58.6% 0, 100% 0, 100% 100%, 52.8% 100%);
}

/* Yellow diagonal. Artwork: x 441..476 at the top, x 395..429 at the bottom. */
.dt-foot__accent {
  position: absolute;
  inset: 0;
  background: var(--d-yellow);
  clip-path: polygon(54% 0, 58.3% 0, 52.6% 100%, 48.4% 100%);
}

/* Thin dark diagonal in the bottom-left corner. */
.dt-foot__corner {
  position: absolute;
  left: 0;
  top: 0;
  width: 64px;
  height: 100%;
  background: #3a3d3f;
  clip-path: polygon(0 0, 30% 0, 0 100%);
}

.dt-foot__tag {
  position: relative;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2.8px;
  line-height: 1.6;
  color: var(--d-black);
  white-space: nowrap;
}

.dt-foot__web {
  position: relative;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
}

/* ==========================================================================
   CONTINUATION MASTHEAD  (page 2 onwards)
   Same artwork, compact, so a continuation page is mostly shipment items.
   ========================================================================== */

.dt-conthead {
  position: relative;
  flex: 0 0 auto;
  height: 74px;
  display: flex;
  align-items: center;
  padding: 0 21px;
  background: #ffffff;
  border-bottom: 4px solid var(--d-yellow);
  overflow: hidden;
}

/* The ticket logo is wide and short (1674:816), so it needs a fair width for
   the EQUIPMENT / SALES / SERVICE line to stay legible: 136px is 66px tall,
   which clears the 70px of content inside this band. */
.dt-conthead__logo { width: 136px; flex: 0 0 auto; }
.dt-conthead__logo img { display: block; width: 100%; height: auto; }

.dt-conthead__title { margin-left: auto; text-align: right; }

.dt-conthead__line {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .2px;
  color: var(--d-ink);
}

.dt-conthead__page {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.6px;
  color: #6a6a6a;
  margin-top: 4px;
}

/* ==========================================================================
   EDITOR: the third items column is narrow, like on the ticket
   ========================================================================== */

.items--dt .items__head,
.items--dt .item-row {
  grid-template-columns: 72px minmax(0, 1fr) 132px 36px;
}

/* ==========================================================================
   PRINT
   ========================================================================== */

@media print {
  .sheet.dt {
    box-shadow: none !important;
    margin: 0 !important;
    width: 8.5in;
    height: 11in;
  }

  /* Exactly one page break between sheets - and none after the last, which is
     what would otherwise produce a trailing blank page. */
  .sheet.dt { break-after: page; page-break-after: always; }
  .sheet.dt:last-child { break-after: auto; page-break-after: auto; }

  .dtbl tr,
  .dt-ship,
  .dt-bottom,
  .dt-thanks { break-inside: avoid; page-break-inside: avoid; }
}
