/* Etiquetas: ZPL para PDF, PDF para ZPL e gerador de código de barras (complementa styles.css e studio.css) */
.lb { --lb-gap: 16px; }
.lb-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; min-width: 0; }
.lb-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 10px; flex-wrap: wrap; }
.lb-h { font-family: var(--display); font-size: 19px; letter-spacing: -.02em; margin: 0; }
.lb-head-btns { display: flex; gap: 6px; }

/* troca ZPL ⇄ PDF */
.lb-switch { display: flex; justify-content: center; gap: 4px; margin: -12px auto 22px; padding: 4px; width: max-content; max-width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 99px; }
.lb-switch a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 99px; font-size: 14px; font-weight: 600; color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.lb-switch a .ic { width: 16px; height: 16px; }
.lb-switch a:hover { color: var(--ink); background: var(--bg-2); }
.lb-switch a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 0 0 1px var(--line); }
.lb-switch a[aria-current="page"] .ic { color: var(--ship); }

/* layout: coluna de entrada + resultado */
.lb-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--lb-gap); align-items: start; }
.lb-side, .lb-main { display: flex; flex-direction: column; gap: var(--lb-gap); min-width: 0; }
@media (min-width: 980px) {
  .lb-layout { grid-template-columns: 390px minmax(0, 1fr); }
  .lb-side { position: sticky; top: 84px; }
  .lb-layout > .lb-local { grid-column: 1 / -1; }
}

/* código */
.lb-code { display: block; width: 100%; min-height: 200px; height: 240px; resize: vertical; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg); color: var(--ink); padding: 12px; font: 12.5px/1.5 ui-monospace, Menlo, Consolas, monospace; outline: none; white-space: pre-wrap; word-break: break-all; }
.lb-code:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.lb-input.over { border-color: var(--accent); background: var(--accent-soft); }
.lb-open { width: 100%; margin-top: 12px; cursor: pointer; }
.lb-hint { margin: 10px 2px 0; font-size: 13px; color: var(--muted); }
.lb-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.lb-files:empty { display: none; }
.lb-file { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 5px 6px 5px 10px; border-radius: 99px; background: var(--ship-soft); color: var(--ink); font-size: 12.5px; font-weight: 500; }
.lb-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lb-file button { width: 22px; height: 22px; flex: none; border: 0; border-radius: 50%; background: transparent; color: var(--ink-2); cursor: pointer; font-size: 15px; line-height: 1; }
.lb-file button:hover { background: var(--surface); color: var(--ink); }

/* opções */
.lb-opts { display: flex; flex-direction: column; gap: 14px; }
.lb-opts .lb-card-head { margin: 0; }
.lb-opts .check { line-height: 1.35; align-items: flex-start; }
.lb-opts .check input { margin-top: 1px; flex: none; }
.lb-custom { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.lb-custom label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.lb-custom input { width: 74px; height: 38px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg); color: var(--ink); padding: 0 8px; font: inherit; }
.lb-custom input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ajuda */
.lb-help { padding: 0; }
.lb-help > summary { cursor: pointer; padding: 14px 16px; font-weight: 600; font-size: 14px; list-style: none; display: flex; align-items: center; gap: 8px; }
.lb-help > summary::-webkit-details-marker { display: none; }
.lb-help > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; margin: 0 4px 0 2px; flex: none; }
.lb-help[open] > summary::before { transform: rotate(45deg); }
.lb-help ul { margin: 0; padding: 0 16px 0 34px; display: grid; gap: 8px; font-size: 13.5px; color: var(--ink-2); }
.lb-help p { margin: 10px 16px 16px; font-size: 13px; color: var(--muted); }
.lb-help code { font: 12px ui-monospace, Menlo, monospace; background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; overflow-wrap: anywhere; color: var(--ink); }

/* barra de ações */
.lb-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; flex-wrap: wrap; padding: 12px 14px; }
.lb-count { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.lb-count b { font-size: 15px; }
.lb-count span { font-size: 12.5px; color: var(--muted); }
.lb-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (min-width: 980px) { .lb-main > .lb-bar { position: sticky; top: 84px; z-index: 4; } }
@media (max-width: 560px) {
  .lb-actions { width: 100%; }
  .lb-actions .btn { flex: 1 1 auto; padding-left: 12px; padding-right: 12px; }
  .lb-actions .btn-primary { flex-basis: 100%; }
}

.lb-warn { margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); color: var(--ink-2); font-size: 13px; }
.lb-warn code { font: 12px ui-monospace, Menlo, monospace; color: var(--ink); }

/* vazio */
.lb-empty { display: grid; place-items: center; text-align: center; gap: 6px; padding: 40px 20px; border: 2px dashed var(--line-2); border-radius: var(--radius); color: var(--muted); font-size: 14.5px; min-height: 320px; align-content: center; }
.lb-empty svg { width: 96px; height: 96px; }
.lb-empty p { margin: 0; max-width: 300px; }
.lb-empty .e-label { fill: var(--surface); stroke: var(--line-2); stroke-width: 2; }
.lb-empty .e-bars { stroke: var(--ink-2); stroke-width: 2.4; }
.lb-empty .e-line { stroke: var(--line-2); stroke-width: 4; stroke-linecap: round; }

/* grade de prévias */
.lb-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 14px; }
.lb-grid li { display: flex; flex-direction: column; align-items: center; gap: 8px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 14px 12px 10px; min-width: 0; }
.lb-grid img, .lb-grid canvas { display: block; max-width: 100%; max-height: 460px; width: auto; height: auto; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 6px 16px -8px rgba(0,0,0,.35); border-radius: 3px; image-rendering: auto; }
.lb-cap { font-size: 12.5px; color: var(--ink-2); font-weight: 600; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center; }
.lb-cap small { color: var(--muted); font-weight: 500; }
.lb-tag { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: var(--ship-soft); color: var(--ship); }
.lb-grid.one { grid-template-columns: minmax(0, 1fr); }
.lb-grid.one img, .lb-grid.one canvas { max-height: 640px; }

.lb-busy { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 18px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.lb-busy .pg-loading { width: 22px; height: 22px; }

.lb-codeout .lb-code { height: 180px; min-height: 120px; }
.lb-size { font-size: 12.5px; color: var(--muted); }

/* próximos passos */
.lb-next { animation: pop .25s ease; scroll-margin-top: 90px; }
.lb-next-title { margin: 0 0 12px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lb-ok { width: 24px; height: 24px; border-radius: 50%; background: var(--zap); color: #15121f; display: grid; place-items: center; font-size: 13px; font-weight: 800; }
.lb-next .chip { color: var(--ink); text-decoration: none; }

.lb-local { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 6px 0 0; font-size: 13px; color: var(--muted); text-align: center; }
.lb-local .ic { width: 16px; height: 16px; flex: none; color: var(--ship); }
#p2z > .dropzone { max-width: 880px; margin: 0 auto; }
#p2z > .lb-layout { margin-top: 0; }

/* ================= Gerador de código de barras ================= */
.bc-modes { margin: -12px auto 22px; }
.bc-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--lb-gap); align-items: start; }
@media (min-width: 980px) { .bc-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); } .bc-preview-col { position: sticky; top: 84px; } }
.bc-form { display: flex; flex-direction: column; gap: 16px; }
.bc-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
.bc-type { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 9px 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); cursor: pointer; font: inherit; min-width: 0; }
.bc-type b { font-size: 13.5px; font-weight: 600; }
.bc-type span { font-size: 11.5px; color: var(--muted); }
.bc-type:hover { border-color: var(--line-2); background: var(--bg-2); }
.bc-type[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.bc-type[aria-checked="true"] span { color: var(--ink-2); }
.bc-hint { margin: 0; font-size: 13px; color: var(--muted); }
.bc-valrow { position: relative; }
.bc-valrow .input { font: 500 16px ui-monospace, Menlo, Consolas, monospace; letter-spacing: .02em; padding-right: 40px; }
.bc-valrow .input[aria-invalid="true"] { border-color: var(--accent); }
.bc-state { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.bc-state.ok { background: var(--ship-soft); color: var(--ship); }
.bc-state.bad { background: var(--accent-soft); color: var(--accent); }
.bc-msg { min-height: 18px; margin: 6px 2px 0; font-size: 13px; color: var(--ink-2); }
.bc-msg.bad { color: var(--accent); font-weight: 500; }
.bc-msg.ok { color: var(--ship); font-weight: 500; }
.bc-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.bc-colors { display: flex; gap: 14px; flex-wrap: wrap; }
.bc-colors label { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); }
.bc-colors input[type=color] { width: 40px; height: 34px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--bg); padding: 3px; cursor: pointer; }
.bc-note { margin: 0; font-size: 12.5px; color: var(--muted); }

.bc-stage { display: grid; place-items: center; min-height: 240px; padding: 28px 18px; border-radius: 14px; background: repeating-conic-gradient(var(--bg-2) 0% 25%, var(--bg) 0% 50%) 50% / 18px 18px; border: 1px solid var(--line); overflow: hidden; }
.bc-stage svg, .bc-stage img { display: block; max-width: 100%; height: auto; box-shadow: 0 1px 2px rgba(0,0,0,.1), 0 8px 20px -10px rgba(0,0,0,.35); }
.bc-stage .bc-err { color: var(--muted); font-size: 14px; text-align: center; max-width: 280px; }
.bc-dims { margin: 10px 2px 0; font-size: 12.5px; color: var(--muted); text-align: center; }
.bc-dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.bc-dl .btn { padding-left: 10px; padding-right: 10px; }
.bc-dpi { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.bc-dpi .seg { flex: 0 1 auto; }

.bc-batch-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; max-height: 520px; overflow: auto; }
.bc-batch-grid li { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: grid; place-items: center; min-height: 90px; }
.bc-batch-grid li svg { max-width: 100%; height: auto; }
.bc-batch-grid li.bad { background: var(--bg-2); color: var(--accent); font-size: 12px; text-align: center; overflow-wrap: anywhere; }
.bc-sheet { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.bc-sheet .field input { height: 40px; }
@media (max-width: 520px) {
  .bc-dl { grid-template-columns: minmax(0, 1fr); }
  .bc-sheet { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lb-card { padding: 14px; }
}
@media (max-width: 979px) { #onePreview { order: -1; } }
