/* Vial Label Maker */
.vl { padding-top: 6px; }
.vl-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr); gap: 16px; align-items: start; }
.vl-panel { padding: 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.vl-panel h2 { margin: 0 0 8px; font-size: 22px; }
.vl-side { position: sticky; top: 88px; }
.vl-help { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.vl-label-title { display: block; color: var(--text); font-size: 14px; font-weight: 700; }
.vl-label-title span, .vl-field label span { color: var(--faint); font-weight: 500; }
.vl select, .vl input:not([type]), .vl input[type=date], .vl input[type=number] {
  width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--bg); color: var(--text); font: inherit; color-scheme: dark;
}
.vl select:focus, .vl input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34, 211, 238, .15); }

.vl-items { display: grid; gap: 12px; margin-bottom: 12px; }
.vl-item { padding: 16px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg-2); }
.vl-item__head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.vl-item__head strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vl-item__num { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 700; }
.vl-remove { padding: 6px 8px; border: 0; background: none; color: var(--faint); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.vl-remove:hover { color: #fca5a5; }
.vl-item__body { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: start; }
.vl-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.vl-field { display: grid; gap: 6px; align-content: start; }
.vl-field[hidden] { display: none; }
.vl-field > label { color: var(--text); font-size: 14px; font-weight: 700; }
.vl-field--wide { grid-column: 1 / -1; }
.vl-inline { display: grid; grid-template-columns: minmax(0, 1fr) 76px; gap: 6px; }
.vl-check { display: flex; align-items: flex-start; gap: 8px; color: var(--muted); font-size: 14px; cursor: pointer; }
.vl-check input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--cyan); }
.vl-colors { display: flex; flex-wrap: wrap; gap: 8px; }
.vl-swatch { position: relative; display: grid; justify-items: center; gap: 3px; cursor: pointer; }
.vl-swatch input { position: absolute; opacity: 0; pointer-events: none; }
.vl-swatch span { width: 26px; height: 26px; border: 2px solid transparent; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .25); }
.vl-swatch.is-none span { background: repeating-linear-gradient(45deg, var(--surface-2) 0 4px, var(--bg) 4px 8px); box-shadow: inset 0 0 0 1px var(--line-2); }
.vl-swatch em { color: var(--faint); font-size: 11px; font-style: normal; }
.vl-swatch input:checked + span { border-color: #fff; box-shadow: 0 0 0 2px var(--cyan); }
.vl-swatch input:checked ~ em { color: var(--text); font-weight: 700; }
.vl-swatch input:focus-visible + span { outline: 2px solid var(--cyan); outline-offset: 2px; }
.vl-add { width: 100%; justify-content: center; }

/* Preview at 3x real size */
.vl-preview { display: grid; gap: 6px; }
.vl-preview__stage { width: 3in; height: 1.5in; border-radius: 6px; box-shadow: 0 0 0 1px var(--line-2), 0 8px 24px rgba(0, 0, 0, .35); overflow: hidden; background: #fff; }
.vl-preview__stage .vl-label { transform: scale(3); transform-origin: top left; }

/* The label itself: real size in inches and points, identical on screen and paper */
.vl-label { position: relative; box-sizing: border-box; display: flex; width: 1in; height: .5in; padding: 2.2pt; overflow: hidden; background: #fff; color: #000; font-family: Arial, Helvetica, sans-serif; }
.vl-label.has-stripe { padding-left: 7pt; }
.vl-label__stripe { position: absolute; top: 0; bottom: 0; left: 0; width: 4pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.vl-label__body { display: flex; flex: 1; flex-direction: column; justify-content: center; min-width: 0; }
.vl-label__line { overflow: hidden; line-height: 1.12; text-align: center; white-space: nowrap; }
.vl-label__line.is-name { font-weight: 700; }
.vl-label__line.is-empty { color: #999; }

/* Sheet map: 8 x 20 spots, same proportions as the real sheet */
.vl-map { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-width: 260px; margin: 0 auto 8px; padding: 6px; border-radius: 6px; background: #f1f5f9; }
.vl-cell { aspect-ratio: 2 / 1; padding: 0; border: 1px solid #cbd5e1; border-radius: 2px; background: #fff; cursor: pointer; }
.vl-cell.is-skipped { border-style: dashed; background: repeating-linear-gradient(45deg, #e2e8f0 0 3px, #f8fafc 3px 6px); }
.vl-cell.is-filled { border-color: #0e7490; background: #22d3ee; }
.vl-cell.is-start { outline: 2px solid #f97316; outline-offset: 1px; }
.vl-cell:hover, .vl-cell:focus-visible { outline: 2px solid #0ea5e9; outline-offset: 1px; }
.vl-summary { margin: 0 0 4px; color: var(--text); font-size: 14px; font-weight: 600; text-align: center; }
.vl-link { display: block; margin: 0 auto 14px; padding: 4px; border: 0; background: none; color: var(--cyan); font: inherit; font-size: 13px; cursor: pointer; }
.vl-nudge { margin: 0 0 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.vl-nudge__pad { display: grid; grid-template-columns: repeat(3, 40px); grid-template-rows: repeat(3, 34px); gap: 4px; justify-content: center; margin: 8px 0; }
.vl-nudge__pad button { border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg); color: var(--text); font-size: 13px; cursor: pointer; }
.vl-nudge__pad button:hover { border-color: var(--cyan); color: var(--cyan); }
.vl-nudge__pad [data-nudge="y:-0.5"] { grid-column: 2; grid-row: 1; }
.vl-nudge__pad [data-nudge="x:-0.5"] { grid-column: 1; grid-row: 2; }
.vl-nudge__pad [data-nudge="reset"] { grid-column: 2; grid-row: 2; }
.vl-nudge__pad [data-nudge="x:0.5"] { grid-column: 3; grid-row: 2; }
.vl-nudge__pad [data-nudge="y:0.5"] { grid-column: 2; grid-row: 3; }
.vl-step3 { margin: 16px 0 8px; }
.vl-actions { display: grid; gap: 8px; }
.vl-actions .calc-btn { justify-content: center; }
.vl-status { min-height: 1.3em; margin: 10px 0; color: var(--green); font-size: 13px; font-weight: 600; }

.vl-products { margin-top: 28px; }
.vl-products__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin-bottom: 12px; }
.vl-products__head h2 { margin: 0; font-size: 22px; }
.vl-products .supply-disclosure { margin: 0; }
.vl-info { margin-top: 40px; }

.vl-print { display: none; }

@media (max-width: 1080px) {
  .vl-grid { grid-template-columns: 1fr; }
  .vl-side { position: static; }
}
@media (max-width: 640px) {
  .vl-panel { padding: 14px; }
  .vl-item__body { grid-template-columns: 1fr; }
  .vl-fields { grid-template-columns: 1fr; }
  .vl-preview__stage { width: 2in; height: 1in; }
  .vl-preview__stage .vl-label { transform: scale(2); }
}

/* Print: only the label sheets, at exact size, no page margins. */
@media print {
  @page { size: letter; margin: 0; }
  html, body { margin: 0 !important; padding: 0 !important; background: #fff !important; }
  .vl-screen, .site-header, .site-footer, .skip-link, .messages { display: none !important; }
  main { margin: 0 !important; padding: 0 !important; }
  .vl-print { display: block !important; }
  .vl-page { position: relative; width: 8.5in; height: 11in; overflow: hidden; break-after: page; page-break-after: always; }
  .vl-page:last-child { break-after: auto; page-break-after: auto; }
  .vl-page .vl-label { position: absolute; }
  .vl-page.has-outlines .vl-label { outline: .5pt solid #888; outline-offset: -.25pt; }
}
