/* QR Code Generator (Batch 1, tool four). */

/* ---------- the form ---------- */
/* Sections inside the form (one code, Wi-Fi, several codes) stack their settings with the form's own 24px spacing; a
   hidden section stays hidden. (Without this, settings inside them touched: 0px apart.) */
.qr-stack:not([hidden]) { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; min-width: 0; }
/* The site gives [data-for] sections their parent's gap; a single field keeps the field's own 10px. */
.qr-stack > .field[data-for] { gap: 10px; }
.qr-type-hint { margin-top: 0; }
.qr-check-hint { display: grid; gap: 6px; }
.qr-batch-note:not([hidden]) { display: grid; gap: 10px; }
.qr-online { margin-top: -4px; }
.qr-check-hint .field__hint { margin: 0; padding-left: 28px; }
#qr-more .more__set { display: none; } /* its summary line already says what each option is set to */
.qr-options .chips { flex-wrap: wrap; }
.qr-warning { margin: 0; padding: 12px 14px; border-left: 4px solid var(--graphite); border-radius: 6px; background: var(--mist); color: var(--graphite); font-size: 15px; font-weight: 600; }
.qr-secret { display: flex; gap: 8px; align-items: stretch; }
.qr-secret .input { flex: 1 1 auto; min-width: 0; }
.qr-show { flex: 0 0 auto; min-width: 5.5em; min-height: 44px; }
.qr-count { margin: 0; font-size: 14px; color: var(--slate); }
.qr-count:empty { display: none; }
.qr-empty { margin: 0; color: var(--slate); }
/* A fieldset is as wide as its widest content unless told otherwise: the table scrolls inside its own box. */
.qr-rows, .qr-options, #qr-several { min-width: 0; }
.qr-table-wrap { position: relative; margin-top: 0; overflow-x: auto; max-width: 100%; } /* relative: hidden labels inside it stay inside it */
.qr-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.qr-table th, .qr-table td { padding: 6px 4px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--mist); }
.qr-table thead th { font-size: 13px; font-weight: 600; color: var(--slate); }
.qr-table .qr-num { width: 2em; padding-top: 14px; color: var(--slate); }
.qr-table .qr-tick { text-align: center; padding-top: 14px; }
.qr-table .qr-tick input { width: 22px; height: 22px; }
.qr-table .input { width: 100%; min-width: 8em; min-height: 40px; font-size: 15px; }
.qr-table select.input { min-width: 10em; }
.qr-table textarea.input { resize: vertical; min-height: 40px; }
.qr-card-label, .qr-num__card { display: none; }
.qr-row-do { display: flex; flex-wrap: wrap; gap: 8px; }
.qr-custom { display: grid; gap: 10px; }
.qr-custom > .field__hint { margin-top: -4px; }
.qr-custom > label { display: block; font-weight: 600; }
.qr-custom__row { display: flex; gap: 10px; align-items: center; }
.qr-picker { width: 52px; height: 44px; padding: 0; border: 1px solid var(--silver); border-radius: 8px; background: none; }
.qr-hex { max-width: 9em; text-transform: uppercase; }
.qr-colour-note { margin: 8px 0 0; font-size: 15px; color: var(--slate); }
.qr-colour-note.is-bad { color: var(--graphite); font-weight: 600; }
.qr-colour-note .btn { margin-top: 6px; }
.qr-problems { margin-top: 0; padding: 12px 14px; border-radius: 10px; background: var(--mist); color: var(--graphite); font-size: 15px; }
.qr-problems__list { margin: 0; padding: 0 0 0 18px; display: grid; gap: 8px; }
.qr-problems__list + .qr-problems__list, .qr-problems__list + .qr-dropped, .qr-dropped + .qr-problems__list { margin-top: 10px; }
.qr-problems__list--warn { color: var(--slate); }
.qr-problems .btn { margin: 4px 6px 0 0; min-height: 36px; }
.qr-dropped { margin: 0; font-weight: 600; }

/* ---------- phones: each row becomes a labelled card (no sideways scrolling); wider screens keep the table ---------- */
@media screen and (max-width: 640px) {
  .qr-table-wrap { overflow-x: visible; }
  .qr-table thead { display: none; }
  .qr-table, .qr-table tbody { display: block; width: 100%; }
  .qr-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 12px; align-items: center; margin: 0 0 12px; padding: 12px; border: 1px solid var(--silver); border-radius: 10px; background: var(--white); }
  .qr-table td { display: block; grid-column: 1 / -1; min-width: 0; padding: 0; border: 0; }
  .qr-table .qr-num { grid-column: 1; grid-row: 1; width: auto; padding: 0; color: var(--graphite); font-weight: 600; }
  .qr-table .qr-del { grid-column: 2; grid-row: 1; }
  .qr-table .qr-del .btn { margin: 0; min-height: 44px; }
  .qr-num__n { display: none; }
  .qr-num__card { display: inline; }
  .qr-card-label { display: block; margin: 0 0 4px; font-size: 14px; font-weight: 600; color: var(--graphite); }
  .qr-table .input, .qr-table select.input { width: 100%; min-width: 0; min-height: 44px; font-size: 16px; }
  .qr-table .qr-tick { display: flex; align-items: center; gap: 10px; padding: 0; text-align: left; min-height: 44px; }
  .qr-table .qr-tick input { flex: 0 0 auto; width: 24px; height: 24px; margin: 0; }
  .qr-card-label--tick { display: inline; margin: 0; font-weight: 400; }
}

/* ---------- on screen: the preview ---------- */
.qr-preview { display: block; }
.qr-preview__empty { margin: 0; padding: 40px 12px; text-align: center; color: var(--slate); }
.qr-preview__one { display: grid; justify-items: center; gap: 10px; text-align: center; }
.qr-preview__code { display: block; width: min(320px, 100%); height: auto; aspect-ratio: 1; border: 1px solid var(--mist); }
.qr-preview__label { margin: 0; font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
.qr-preview__holds { margin: 0; max-width: 32em; font-size: 14px; color: var(--slate); overflow-wrap: anywhere; white-space: pre-wrap; }
.qr-preview__holds span { font-weight: 600; }
.qr-preview__see { margin: 0; font-size: 15px; font-weight: 600; }
.qr-preview__see a { color: var(--graphite); }
.qr-preview__count { margin: 0 0 10px; font-weight: 600; }
.qr-preview__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
.qr-preview__item { margin: 0; display: grid; gap: 4px; }
.qr-preview__item svg { display: block; width: 100%; height: auto; aspect-ratio: 1; border: 1px solid var(--mist); }
.qr-preview__item figcaption { font-size: 13px; line-height: 1.25; overflow-wrap: anywhere; }
.qr-preview__more { margin: 10px 0 0; color: var(--slate); }

/* ---------- paper: A4 portrait pages, each laid out to its own margins ---------- */
.qr-page { position: relative; box-sizing: border-box; width: 794px; height: 1123px; padding: 45px; background: var(--white); color: var(--graphite); overflow: hidden; }
.qr-grid { display: grid; height: 100%; align-content: start; }
.qr-cell { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; }
.qr-cell__code { display: block; flex: 0 0 auto; }
.qr-cell__label, .qr-cell__detail { width: 100%; margin: 0; overflow: hidden; overflow-wrap: anywhere; }
.qr-cell__label { font-weight: 600; }
.qr-cell__detail { color: var(--graphite); }
/* Large: one code a page, 120 mm, centred */
.qr-page--large .qr-grid { align-content: center; }
.qr-page--large .qr-cell__label { margin-top: 18px; font-size: 26px; line-height: 1.25; max-height: calc(26px * 1.25 * 3); }
.qr-page--large .qr-cell__detail { margin-top: 10px; font-size: 16px; line-height: 1.35; max-height: calc(16px * 1.35 * 4); }
/* Medium: 6 a page (2 across, 3 down), 64 mm */
.qr-page--medium .qr-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(3, 1fr); column-gap: 20px; }
.qr-page--medium .qr-cell { padding-top: 6px; }
.qr-page--medium .qr-cell__label { margin-top: 6px; font-size: 15px; line-height: 1.25; max-height: calc(15px * 1.25 * 2); }
.qr-page--medium .qr-cell__detail { margin-top: 3px; font-size: 11px; line-height: 1.3; max-height: calc(11px * 1.3 * 3); }
/* Small: 20 a page (4 across, 5 down), 38 mm */
.qr-page--small .qr-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(5, 1fr); column-gap: 12px; }
.qr-page--small .qr-cell { padding-top: 4px; }
.qr-page--small .qr-cell__label { margin-top: 4px; font-size: 11px; line-height: 1.25; max-height: calc(11px * 1.25 * 2); }
.qr-page--small .qr-cell__detail { margin-top: 2px; font-size: 8px; line-height: 1.3; max-height: calc(8px * 1.3 * 2); }
.qr-page .paper__foot { position: absolute; left: 45px; right: 45px; bottom: 14px; margin: 0; }

@media screen {
  /* Every page, laid out at full size off screen: checked there, printed and put in the PDF from there. Nothing is
     ever shown by un-hiding it. */
  .qr-sheets { position: absolute; left: -40000px; top: 0; width: 794px; pointer-events: none; }
}
@page { size: A4 portrait; margin: 0; }
@page :first { margin: 0; }
@media print {
  .qr-preview, template { display: none !important; }
  .qr-sheets { position: static !important; left: auto !important; width: auto !important; }
  #sheet.qr-sheet { margin: 0 !important; padding: 0 !important; }
  .qr-page { break-after: page; page-break-after: always; }
  .qr-page:last-child { break-after: auto; page-break-after: auto; }
}
