/* Barcode generator. Loaded only on the barcode pages; builds on style.css tokens. */
.bc-grid { display: grid; gap: 0.9rem 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); margin-top: 0.5rem; }
.bc-grid .field--wide { grid-column: 1 / -1; }
.bc-grid input[type='number'] { width: 100%; }
.tool[data-tool='barcode'] input[type='number'] {
  font: inherit; font-size: 0.97rem; min-height: 44px; padding: 0.5rem 0.75rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-m);
}
.tool[data-tool='barcode'] input[aria-invalid='true'] { border: 2px solid var(--text); }
.bc-code-row { display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; align-items: end; }
.bc-code-row .field { flex: 1 1 16rem; }
.bc-code-row input { font-family: var(--mono); letter-spacing: 0.02em; }
.bc-fixes { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.bc-fixes:not(:has(button:not([hidden]))) { display: none; }
.bc-units { border: 0; padding: 0; margin: 0; display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.bc-units legend { font-weight: 600; font-size: 0.93rem; float: left; margin-right: 0.5rem; }
.bc-units .check { min-height: 44px; }
.bc-custom { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.bc-custom .field { width: 8.5rem; }

/* Preview: white label on a soft checker so the label edge is always visible, dashed outline = cut line. */
.bc-preview { margin-top: 1rem; }
.bc-canvas {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-m);
  padding: clamp(0.75rem, 3vw, 1.5rem); overflow: auto; display: grid; place-items: center; min-height: 10rem;
}
.bc-stage { width: min(100%, 520px); max-height: 70vh; outline: 1.5px dashed var(--border-strong); outline-offset: 0; background: #fff; display: grid; place-items: center; }
.bc-stage svg { display: block; width: 100%; height: 100%; }
.bc-stage.is-actual { width: var(--bc-w); max-height: none; }
.bc-stage.is-actual svg { width: var(--bc-w); height: var(--bc-h); }
.bc-stage:has(.bc-empty) { width: 100%; outline: 0; background: transparent; }
.bc-empty { margin: 0; text-align: center; }
.bc-stats { font-size: 0.88rem; color: var(--text-2); margin: 0.6rem 0 0; }
.bc-warnings { list-style: none; padding: 0; margin: 0; }
.bc-warnings .status { margin-top: 0.6rem; font-size: 0.93rem; }
.bc-legend { font-size: 0.85rem; color: var(--text-2); margin: 0.4rem 0 0; }
.bc-legend i { display: inline-block; width: 0.9em; height: 0.9em; vertical-align: -0.1em; background: rgba(35, 80, 230, 0.15); border: 1px solid rgba(35, 80, 230, 0.35); }
.bc-print-tips { font-size: 0.93rem; }
.bc-print-tips ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }

/* Tabs: one label / many labels. */
.bc-tabs { display: flex; flex-wrap: wrap; gap: 0.25rem; border-bottom: 1px solid var(--border); margin: -0.25rem 0 0.25rem; }
.bc-tabs [role='tab'] {
  font: inherit; font-weight: 700; color: var(--text-2); background: none; border: 0; border-bottom: 3px solid transparent;
  padding: 0.7rem 0.9rem; min-height: 44px; cursor: pointer; margin-bottom: -1px;
}
.bc-tabs [role='tab'][aria-selected='true'] { color: var(--text); border-bottom-color: var(--accent); }
.bc-tabs [role='tab']:hover { color: var(--text); }
.bc-tabs + [role='tabpanel'] > .tool__step:first-child, [role='tabpanel'] > .tool__step:first-child { border-top: 0; margin-top: 0.5rem; }

/* Bulk mode. */
.bk-type { max-width: 26rem; margin-bottom: 1rem; }
.bk-samples { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 1rem 0 0; }
.tool[data-tool='barcode'] textarea, .tool[data-tool='check-digit'] textarea {
  font: inherit; font-family: var(--mono); font-size: 0.9rem; width: 100%; padding: 0.6rem 0.75rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-m); resize: vertical;
}
.bk-invalid { margin: 1rem 0 0; }
.table-scroll { overflow-x: auto; max-width: 100%; }
.bk-table-wrap { max-height: 32rem; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-s); margin-top: 0.5rem; }
.bk-table { margin: 0; font-size: 0.88rem; min-width: 52rem; }
.bk-table thead th { position: sticky; top: 0; background: var(--surface-2); z-index: 1; }
.bk-table input { width: 100%; min-width: 5rem; font: inherit; padding: 0.3rem 0.4rem; border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--text); }
.bk-table input:hover, .bk-table input:focus { border-color: var(--border-strong); background: var(--surface); }
.bk-table input:disabled { color: var(--text-2); }
.bk-table .bk-code { font-family: var(--mono); min-width: 9.5rem; }
.bk-table .bk-qty { min-width: 3.5rem; width: 4rem; }
.bk-status { white-space: nowrap; }
.bk-msgs { min-width: 14rem; color: var(--text-2); font-size: 0.82rem; }
.bk-msgs p { margin: 0 0 0.25rem; }
.bk-row--error td, .bk-row--error th { background: var(--flag-bg); }
.bk-row--error .bk-msgs { color: var(--text); }
.bk-row.is-hit td, .bk-row.is-hit th { box-shadow: inset 0 2px 0 var(--accent), inset 0 -2px 0 var(--accent); }
.bk-pager, .bk-toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; align-items: center; margin-top: 0.75rem; }
.bk-toolbar { margin-top: 1rem; }
.bk-zoom { margin-left: auto; display: flex; gap: 0.4rem; align-items: center; font-size: 0.93rem; }
.bk-preview { margin-top: 0.5rem; place-items: start center; max-height: 80vh; }
.bk-preview svg { display: block; background: #fff; box-shadow: 0 1px 4px rgba(16, 24, 40, 0.18); max-width: none; }
.bk-preview:not(.is-zoomed) svg { max-width: 100%; }
.bc-sheet-label { cursor: pointer; }
.bc-sheet-edge { stroke: #c9cfda; stroke-dasharray: 1 1; }
.bc-sheet-label.is-hit .bc-sheet-edge { stroke: #2350e6; stroke-width: 0.8; stroke-dasharray: none; }
.bk-progress-row { display: flex; gap: 0.75rem; align-items: center; margin-top: 0.75rem; }
.bk-progress-row progress { flex: 1; height: 0.6rem; }

/* Example label images in the page text. */
.bc-example { margin: 1.5rem 0; }
.bc-example img { display: block; max-width: 100%; height: auto; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-s); box-shadow: 0 1px 3px rgba(16, 24, 40, 0.08); }
.bc-example figcaption { font-size: 0.88rem; color: var(--text-2); margin-top: 0.5rem; }
.bc-example-pair { display: flex; flex-wrap: wrap; gap: 1rem; }
.bc-example-pair .bc-example { margin: 0; flex: 1 1 14rem; }

/* Check digit calculator. */
.tool[data-tool='check-digit'] input[type='text'] { font-family: var(--mono); font-size: 1.1rem; letter-spacing: 0.04em; }
#cd-result .status { margin-top: 0.75rem; }
.cd-steps { font-size: 0.88rem; }
.cd-steps th, .cd-steps td { padding: 0.3rem 0.45rem; text-align: center; }

/* Printing the page prints only the label, at its real size. */
@media print {
  @page { margin: 0; }
  .tool[data-tool='barcode'] { display: block !important; border: 0; padding: 0; margin: 0; }
  body * { visibility: hidden; }
  .bc-stage, .bc-stage * { visibility: visible; }
  .bc-stage { position: fixed; left: 0; top: 0; width: var(--bc-w) !important; outline: 0; }
  .bc-stage svg { width: var(--bc-w) !important; height: var(--bc-h) !important; }
  .bc-qz { display: none; }
}
