/* Nothing on the sheet is smaller than 12pt (2.02cqw on the 210mm page). */
/* The A4 job sheet (ported from the factory setup page; cqw units scale it with the page). Shared by Manufacturing Setup > Job Sheets (preview) and Order Tagger > Batch Creator (Job Sheet PDF). */
    .worksheet-a4-page {
      height: 100%;
      width: auto;
      max-width: 100%;
      max-height: 100%;
      aspect-ratio: 210 / 297;
      flex-shrink: 0;
      box-sizing: border-box;
      background: #fff;
      box-shadow: 0 4px 24px rgba(0,0,0,0.18);
      color: #171717;
      container-type: inline-size;
      display: flex;
      flex-direction: column;
      padding-bottom: 2.5cqw;
      position: relative;
    }

    /* The locked worksheet header is exactly 21 cm × 10 cm relative
       to the A4 sheet. All physical sizes below are expressed as a
       percentage of the 21 cm page width so the layout scales as one. */
    .worksheet-fixed-region {
      width: 100%;
      aspect-ratio: 21 / 10;
      display: flex;
      flex-direction: column;
      padding: 3.3333% 4.7619% 3.3333%;
      background: #fff;
      overflow: hidden;
      user-select: none;
      pointer-events: none;
      position: relative;
    }

    /* Same grid definition (columns + gap) as .worksheet-fixed-details
       below, and the same container width (both are plain flex
       children of .worksheet-fixed-region, so both stretch to its
       full content width) — meaning column 2 here lands at the exact
       same pixel position/width as column 2 there, guaranteed by the
       browser's own grid math rather than a hand-copied percentage. */
    .worksheet-fixed-banners {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 7.1429%;
      align-items: start;
      width: 100%;
      flex: 0 0 auto;
    }

    /* Top-left: square logo + grey client-name box, side by side.
       The group is flush with the start of column 1 — the same
       left edge .worksheet-also-box sits flush against below. */
    .worksheet-a4-client-group {
      justify-self: start;
      display: flex;
      flex-direction: row;
      align-items: center;
      gap: 1.5cqw;
    }

    .worksheet-a4-logo {
      display: block;
      width: 4.7619cqw;
      height: 4.7619cqw;
      aspect-ratio: 1 / 1;
      object-fit: contain;
    }

    .worksheet-a4-client {
      width: 23.8095cqw;
      aspect-ratio: 5 / 1;
      display: flex;
      align-items: center;
      justify-content: center;
      background: #d9d9d9;
      color: #171717;
      font-family: 'Barlow', sans-serif;
      font-size: 2.02cqw;
      font-weight: 700;
      letter-spacing: 0.04em;
      line-height: 1.1;
      text-align: center;
      padding: 0 0.3em;
    }

    /* Top-right: black box, white order number. Sits in column 2,
       stretched to that column's full width, then sized to 62.35%
       of it — the exact same width % as .worksheet-barcode uses
       within its own (pixel-identical) column 2 below. Same
       containing-block width in, same rule applied, same result
       out — no coordinates to keep in sync by hand. */
    .worksheet-a4-number-wrap {
      width: 100%;
      min-width: 0;
    }

    .worksheet-a4-number {
      width: 62.35%;
      aspect-ratio: 5 / 1;
      display: flex;
      align-items: center;
      justify-content: center;
      background: #000;
      color: #fff;
      font-family: 'Barlow', sans-serif;
      font-size: 2.1cqw;
      font-weight: 700;
      letter-spacing: 0.08em;
      line-height: 1;
    }

    .worksheet-fixed-details {
      flex: 1 1 auto;
      min-height: 0;
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 7.1429%;
      padding-top: 5%;
      padding-bottom: 5%;
      font-family: 'Barlow', sans-serif;
      font-size: 2.05cqw;
      line-height: 1.35;
    }

    .worksheet-fixed-column {
      min-width: 0;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      height: 100%;
    }

    .worksheet-fixed-field {
      min-height: 1.15em;
      white-space: nowrap;
      display: flex;
      align-items: baseline;
      gap: 0.45em;
    }

    .worksheet-fixed-field--address {
      white-space: normal;
    }

    .worksheet-fixed-label {
      font-weight: 600;
      flex: 0 0 auto;
    }

    .worksheet-fixed-value {
      font-weight: 400;
      color: #333;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .worksheet-fixed-field--address .worksheet-fixed-value {
      white-space: normal;
    }

    .worksheet-barcode-group {
      display: flex;
      flex-direction: column;
    }

    .worksheet-barcode {
      width: 62.35%;
      aspect-ratio: 11 / 3;
      margin-top: 0.15em;
      background:
        repeating-linear-gradient(90deg,
          #050505 0 1.4%, transparent 1.4% 2.2%,
          #050505 2.2% 3.1%, transparent 3.1% 4.8%,
          #050505 4.8% 6.7%, transparent 6.7% 7.5%);
      border: 1px solid rgba(0,0,0,0.1);
    }

    /* Small human-readable code under every barcode on the sheet.
       Font-size matches .worksheet-content-barcode-caption exactly. */
    .worksheet-barcode-caption {
      width: 62.35%;
      margin-top: 0.2em;
      font-family: 'Barlow', sans-serif;
      font-size: 2.02cqw;
      letter-spacing: 0.06em;
      color: #444;
      text-align: center;
    }

    .worksheet-also-box {
      position: relative;
      flex: 0 0 auto;
      width: 100%;
      aspect-ratio: 19 / 1.15;
      padding: 0.5em 0.75em;
      background: #e5e5e5;
      color: #171717;
      font-family: 'Barlow', sans-serif;
      font-size: 2.02cqw;
      font-weight: 700;
    }

    /* "Page x of n" tab: an orange rectangle sitting on the top-right edge of the Also In This Order box, touching it
       (Job Sheet PDF only, when a template's items run to more than one page). */
    .worksheet-page-tag {
      position: absolute;
      right: 0;
      bottom: 100%;
      padding: 0.3em 1.1em;
      background: var(--w-ea6a32,#EA6A32);
      color: #fff;
      font-family: 'Barlow', sans-serif;
      font-size: 2.02cqw;
      font-weight: 700;
      line-height: 1.2;
      white-space: nowrap;
    }

    /* "Qty xn" tab on a condensed line (template option "Condense Same Products"): an orange rectangle sitting on the
       top-right edge of that line's barcode, touching it. */
    .worksheet-qty-tag {
      position: absolute;
      right: 0;
      bottom: 100%;
      padding: 0.3em 1.1em;
      background: var(--w-ea6a32,#EA6A32);
      color: #fff;
      font-family: 'Barlow', sans-serif;
      font-size: 2.02cqw;
      font-weight: 700;
      line-height: 1.2;
      white-space: nowrap;
    }

    /* ── Die Cut Label option ─────────────────────────────────────
       Ticking this adds a dotted 96mm x 64mm box, 10mm in from the
       page's top and right edges: black order-number box top-left,
       a Date/Items block left-aligned within itself but centred
       under that box, a thumbnail of the first item centred in the
       middle of the area, and an Example Label line centred at the
       bottom of the area. Units below are cqw because .worksheet-a4-
       page/.worksheet-designer-page are the container-query ancestor
       at the full 210mm page width, so 1cqw == 2.1mm regardless of
       the region's own height. The original black order-number box,
       and the Order Number/Date/Items fields in the details grid,
       are hidden (they're now duplicated inside the box); what's left
       of column 1 (Customer/Address/Destination/Courier) is squashed
       together near the top, and the lead barcode sits tightly under
       it rather than under the box; and the fixed region grows only
       as much as whichever needs more room — the box, or that left
       column plus the barcode — mirroring the same figure computed
       in drawWorksheetPdfPage for the actual PDF export (~98mm vs.
       100mm normally, since the barcode moved out from under the box
       and no longer drives the extra height). */
    .worksheet-fixed-region--diecut {
      aspect-ratio: 210 / 98;
    }

    .worksheet-fixed-region--diecut .worksheet-a4-number-wrap,
    .worksheet-fixed-region--diecut .worksheet-fixed-field--ordernum,
    .worksheet-fixed-region--diecut .worksheet-fixed-field--date,
    .worksheet-fixed-region--diecut .worksheet-fixed-field--items,
    .worksheet-fixed-region--diecut .worksheet-fixed-field--alias,
    .worksheet-fixed-region--diecut .worksheet-barcode-group:not(.worksheet-barcode-group--diecut) {
      display: none;
    }

    .worksheet-fixed-region--diecut .worksheet-fixed-banners {
      grid-template-columns: 1fr;
    }

    /* Customer/Address/Destination/Courier are all that's left in
       column 1 once Order Number/Date move into the Die Cut box —
       keep them squashed together near the top rather than letting
       space-between stretch just 4 items across the taller region. */
    .worksheet-fixed-region--diecut .worksheet-fixed-details {
      align-items: start;
    }

    .worksheet-fixed-region--diecut .worksheet-fixed-column {
      justify-content: flex-start;
      height: auto;
      gap: 0.5em;
    }

    .worksheet-diecut-box {
      display: none;
      position: absolute;
      top: 4.7619cqw;     /* 10mm from the page's top edge */
      right: 4.7619cqw;   /* 10mm from the page's right edge */
      width: 45.7143cqw;  /* 96mm */
      height: 30.4762cqw; /* 64mm */
      box-sizing: border-box;
      flex-direction: column;
      align-items: center;
      padding: 1.6cqw;
      border: 0.75px dotted rgba(23,23,23,0.6);
      background: #fff;
      z-index: 2;
    }

    .worksheet-fixed-region--diecut .worksheet-diecut-box {
      display: flex;
    }

    /* Order-number box is centred horizontally in the die-cut area
       (not flush left); Date/Items sit inline, on one line, centred
       underneath it — same centre-line since the box itself is now
       centred too. */
    .worksheet-diecut-underbox {
      flex: 0 0 auto;
      width: 55%;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.7cqw;
    }

    .worksheet-diecut-number {
      width: 100%;
      aspect-ratio: 5 / 1;
      display: flex;
      align-items: center;
      justify-content: center;
      background: #000;
      color: #fff;
      font-family: 'Barlow', sans-serif;
      font-size: 2.2cqw;
      font-weight: 700;
      letter-spacing: 0.08em;
    }

    .worksheet-diecut-datepack {
      width: max-content;
      display: flex;
      flex-direction: row;
      gap: 1.2cqw;
    }

    .worksheet-diecut-field {
      display: flex;
      align-items: baseline;
      gap: 0.45em;
      white-space: nowrap;
      font-family: 'Barlow', sans-serif;
      font-size: 2.02cqw;
    }

    /* Thumbnail of the first item on the page — sits in the middle
       of the die-cut area, filling whatever space is left between
       the order-number/date/items block above and the Example Label
       line below. Scaled down to ~65% of its natural fit via
       transform so it reads as a small reference thumbnail rather
       than a dominant image. */
    .worksheet-diecut-thumb-wrap {
      flex: 1 1 auto;
      min-height: 0;
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .worksheet-diecut-thumb {
      max-width: 55%;
      max-height: 100%;
      object-fit: contain;
      transform: scale(0.65);
    }

    /* "Example Label" — always part of the Die Cut box (not an
       independently tickable field); bold black text, centred at
       the bottom of the area itself. */
    .worksheet-diecut-example {
      flex: 0 0 auto;
      width: 100%;
      text-align: center;
      font-family: 'Barlow', sans-serif;
      font-size: 2.02cqw;
      font-weight: 700;
      color: #000;
    }

    /* The lead barcode, pushed to fit tightly under the left-side
       attributes (Customer/Address/Destination/Courier) — a plain
       block-level sibling of .worksheet-fixed-details rather than
       nested in column 2, so it can sit directly beneath that
       squashed block instead of under the Die Cut box.
       Needs its own font-size/family since it's no longer inside
       .worksheet-fixed-details (which is what supplied that before,
       so without this the label fell back to the page default and
       rendered oversized). */
    .worksheet-barcode-group--diecut {
      display: none;
      width: 46%;
      margin-top: 0.6cqw;
      align-self: flex-start;
      font-family: 'Barlow', sans-serif;
      font-size: 2.05cqw;
      line-height: 1.35;
    }

    .worksheet-fixed-region--diecut .worksheet-barcode-group--diecut {
      display: flex;
      flex-direction: column;
    }

    /* ── Worksheet Manager: below-header content area ───────────
       Sits under the locked 21cm × 10cm header and fills the rest
       of the A4 sheet. Divided into 1 (Central/no line), 2 (Split/
       one dotted line) or 4 (Listed/three dotted lines) equal
       sections, driven by the template's saved layout choice. Each
       section reserves its left quarter for an image (kept at its
       own aspect ratio, never stretched); Central instead lets the
       image fill the section and reserves a couple of lines
       underneath for text. */
    .worksheet-content-area {
      flex: 1 1 auto;
      min-height: 0;
      display: flex;
      flex-direction: column;
    }

    .worksheet-content-section {
      flex: 1 1 0;
      min-height: 0;
      display: flex;
      flex-direction: row;
      align-items: stretch;
      position: relative;
    }

    .worksheet-content-section--central {
      flex-direction: column;
    }

    /* Alt Split: same 2-section count as Split, but each section is
       a large thumbnail (top-left, 2/3 width) with its attributes
       in a strip underneath it — rather than image-left/info-middle
       like regular Split. Barcode+icons still sit on the right via
       the same .worksheet-content-side, unaffected by this. */
    .worksheet-content-section--altsplit {
      flex-direction: column;
    }

    /* Dotted divider between sections — inset ~1.5cm off a 21cm-wide
       page (1.5/21 ≈ 7.14%), so the line doesn't run edge to edge. */
    .worksheet-content-divider {
      flex: 0 0 auto;
      height: 0;
      margin: 0 7.1429%;
      border-top: 1.5px dashed rgba(0,0,0,0.35);
    }

    .worksheet-content-image-wrap {
      flex: 0 0 25%;
      width: 25%;
      height: 100%;
      box-sizing: border-box;
      padding-left: 7.1429%;
      display: flex;
      align-items: center;
      justify-content: flex-start;
    }

    .worksheet-content-section--central .worksheet-content-image-wrap {
      flex: 1 1 auto;
      width: 100%;
      min-height: 0;
    }

    .worksheet-content-section--altsplit .worksheet-content-image-wrap {
      flex: 1 1 auto;
      width: 66.6667%;
      min-height: 0;
    }

    .worksheet-content-image {
      display: block;
      max-width: 100%;
      max-height: 65%;
      width: auto;
      height: auto;
      object-fit: contain;
    }

    .worksheet-content-section--central .worksheet-content-image {
      max-height: 78%;
    }

    .worksheet-content-section--altsplit .worksheet-content-image {
      max-height: 78%;
      object-position: left center;   /* keep the picture on the left edge, in line with the text underneath */
    }

    /* Info block: sits between the thumbnail and the barcode.
       padding-right reserves exactly the barcode's own width plus
       its right inset (23.8095% + 7.1429% ≈ 30.95%) so text never
       runs under it, however wide this flex item ends up being. */
    .worksheet-content-info {
      flex: 1 1 auto;
      min-width: 0;
      box-sizing: border-box;
      padding: 0 3%;
      padding-right: 30.9524%;
      display: flex;
      flex-direction: column;
      justify-content: center;
      gap: 0.2em;
      font-family: 'Barlow', sans-serif;
      color: #171717;
      overflow: hidden;
    }

    /* Central: image fills the section, so the info block instead
       becomes a fixed-height strip under it (also holding the
       barcode/caption/icons), sized to comfortably fit a couple of
       lines plus the barcode+caption+icon stack beside it. */
    .worksheet-content-section--central .worksheet-content-info {
      flex: 0 0 auto;
      width: 100%;
      height: 13cqw;
    }

    .worksheet-content-section--altsplit .worksheet-content-info {
      flex: 0 0 auto;
      width: 100%;
      height: 10cqw;
      padding-left: 7.1429%;
      padding-right: 7.1429%;
    }

    .worksheet-content-info-primary {
      font-weight: 700;
      font-size: 2.02cqw;
      line-height: 1.2;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .worksheet-content-info-desc {
      font-weight: 500;
      font-size: 2.02cqw;
      color: #333;
      line-height: 1.2;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .worksheet-content-info-extra {
      display: flex;
      flex-wrap: wrap;
      gap: 0.15em 1.2em;
      font-size: 2.02cqw;
      color: #444;
      line-height: 1.3;
    }

    .worksheet-content-info-extra span { white-space: nowrap; }

    /* Alt Split only: SKU/Alias/Description clump, a divider, then
       the rest of the attributes to its right — not stacked below. */
    .worksheet-content-info-row {
      display: flex;
      flex-direction: row;
      align-items: center;
      gap: 0.9em;
      width: 100%;
      min-width: 0;
    }

    .worksheet-content-info-clump {
      flex: 0 0 auto;
      display: flex;
      flex-direction: column;
      gap: 0.15em;
    }

    .worksheet-content-info-divider {
      flex: 0 0 auto;
      font-size: 2.02cqw;
      font-weight: 300;
      color: #aaa;
      line-height: 1;
    }

    .worksheet-content-info-extra-col {
      flex: 1 1 auto;
      min-width: 0;
      display: flex;
      flex-direction: row;
      flex-wrap: wrap;
      align-content: center;
      gap: 0.15em 1em;
      font-size: 2.02cqw;
      color: #444;
      line-height: 1.3;
    }

    .worksheet-content-info-extra-col span {
      white-space: nowrap;
    }

    /* Barcode + caption + icon-row group: 5cm-wide, right edge on
       the dotted divider's inset (7.1429cqw ≈ 1.5cm — cqw rather
       than % so this always means "% of the page" regardless of
       nesting). Centred as a group in Split/Listed (the barcode
       nudges up from true-centre to make room for the rest);
       bottom-anchored under the image, in Central. */
    .worksheet-content-side {
      position: absolute;
      right: 7.1429cqw;
      top: 50%;
      transform: translateY(-50%);
      width: 23.8095cqw;
      display: flex;
      flex-direction: column;
      align-items: stretch;
      gap: 0.5cqw;
    }

    .worksheet-content-section--central .worksheet-content-side {
      top: auto;
      bottom: 1.2cqw;
      transform: none;
    }

    /* 5cm × 1cm on the real A4 sheet (page is 21cm wide, so width/
       height are expressed as % of page width via cqw). */
    .worksheet-content-barcode {
      flex: 0 0 auto;
      width: 100%;
      height: 4.7619cqw;
      background:
        repeating-linear-gradient(90deg,
          #050505 0 1.4%, transparent 1.4% 2.2%,
          #050505 2.2% 3.1%, transparent 3.1% 4.8%,
          #050505 4.8% 6.7%, transparent 6.7% 7.5%);
      border: 1px solid rgba(0,0,0,0.1);
    }

    /* Small human-readable code under the content-area barcode. */
    .worksheet-content-barcode-caption {
      flex: 0 0 auto;
      width: 100%;
      font-family: 'Barlow', sans-serif;
      font-size: 2.02cqw;
      letter-spacing: 0.06em;
      color: #444;
      text-align: center;
    }

    /* Frame/Mount icon cards — icon, colour swatch (when ticked)
       and a label underneath, spaced evenly under the barcode. */
    .worksheet-content-icons {
      width: 100%;
      display: flex;
      flex-direction: row;
      gap: 0.6cqw;
    }

    .worksheet-icon-card {
      flex: 1 1 0;
      min-width: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.3cqw;
    }

    .worksheet-icon-svg {
      width: 2.6cqw;
      height: 2.6cqw;
      flex-shrink: 0;
    }

    .worksheet-icon-fill { fill: var(--worksheet-icon-color, #d9d9d9); }
    .worksheet-icon-outline { stroke: rgba(0,0,0,0.45); stroke-width: 1.1; }

    .worksheet-icon-label {
      width: 100%;
      font-family: 'Barlow', sans-serif;
      font-size: 2.02cqw;
      color: #333;
      text-align: center;
      line-height: 1.15;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

.worksheet-content-section--central .worksheet-content-image-wrap{justify-content:center;padding-left:0}

/* the sheet is laid out with border-box sizing (Manufacturing Setup sets this globally; other pages may not) */
.worksheet-a4-page,.worksheet-a4-page *{box-sizing:border-box}

/* breathing room between the product alias and the Lead Barcode label under it */
.worksheet-fixed-field--alias{margin-bottom:0.7em}
