/* Etiqueta do produto (parte de style.css) */
/* ============================================================
   ETIQUETA DO PRODUTO — 101,5 × 50 mm
   ============================================================ */
#etiqueta-overlay {
    position: fixed; inset: 0; z-index: 4000;
    display: flex; flex-direction: column; background: #3a3d30;
}
.etq-ecra { position: relative; flex-shrink: 0; width: calc(101.5mm * 2.6); height: calc(50mm * 2.6); box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.etq-ecra-escala { transform: scale(2.6); transform-origin: top left; width: 101.5mm; height: 50mm; }
@media (max-width: 1100px) {
    .etq-ecra { width: calc(101.5mm * 1.6); height: calc(50mm * 1.6); }
    .etq-ecra-escala { transform: scale(1.6); }
}
.etq-impressao { display: none; }

.etq-pagina {
    width: 101.5mm; height: 50mm; box-sizing: border-box; overflow: hidden;
    padding: 3mm 4mm; background: #fff; color: #000;
    display: flex; flex-direction: column; gap: 1.5mm;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
}
.etq-topo { display: flex; align-items: center; justify-content: space-between; gap: 4mm; height: 9mm; flex: 0 0 auto; }
.etq-logo { max-height: 8mm; max-width: 44mm; width: auto; height: auto; object-fit: contain; filter: brightness(0); }
.etq-marca { font-size: 5mm; font-weight: 800; letter-spacing: .3mm; text-transform: uppercase; }
.etq-cor { display: flex; align-items: baseline; gap: 2mm; white-space: nowrap; }
.etq-cor small { font-size: 2.6mm; font-weight: 600; text-transform: uppercase; letter-spacing: .2mm; }
.etq-cor b { font-size: 6.5mm; font-weight: 800; }
.etq-nome {
    flex: 1 1 auto; min-height: 0; font-weight: 800; line-height: 1.15; overflow: hidden;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3;
}
.etq-barras { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: .6mm; }
.etq-svg { width: 100%; height: 14mm; }
.etq-svg svg { display: block; width: 100%; height: 100%; }
.etq-codigo { display: flex; align-items: baseline; gap: 3mm; font-size: 3.4mm; letter-spacing: .5mm; font-weight: 600; font-variant-numeric: tabular-nums; }
.etq-codigo small { font-size: 2.6mm; letter-spacing: 0; font-weight: 500; }
.etq-erro { font-size: 3mm; color: #b00020; height: 14mm; display: grid; place-items: center; }

@media print {
    body.etiqueta-aberta > *:not(#etiqueta-overlay) { display: none !important; }
    body.etiqueta-aberta #etiqueta-overlay { position: static; display: block; background: #fff; }
    body.etiqueta-aberta #etiqueta-overlay .folha-barra,
    body.etiqueta-aberta #etiqueta-overlay .folha-area { display: none; }
    body.etiqueta-aberta .etq-impressao { display: block; }
    body.etiqueta-aberta .etq-impressao .etq-pagina { break-after: page; page-break-after: always; }
    body.etiqueta-aberta .etq-impressao .etq-pagina:last-child { break-after: auto; page-break-after: auto; }
}

/* Etiqueta: nome centrado + quantidade da palete */
.etq-pagina { padding: 2.5mm 3.5mm; gap: 1mm; }
.etq-topo { height: 8mm; }
.etq-nome {
    flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center;
    text-align: center; overflow: hidden;
}
.etq-nome > span {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
    font-weight: 800; line-height: 1.15; text-align: center;
}
.etq-qtd {
    flex: 0 0 auto; display: flex; align-items: baseline; justify-content: center; gap: 2mm;
    padding: .8mm 0; border-top: .3mm solid #000; border-bottom: .3mm solid #000; white-space: nowrap;
}
.etq-qtd b { font-size: 6.6mm; font-weight: 800; line-height: 1; }
.etq-qtd span { font-size: 4mm; font-weight: 700; }
.etq-qtd em { font-style: normal; font-size: 4mm; font-weight: 600; }
.etq-svg { height: 11mm; }
.etq-erro { height: 11mm; }

/* Câmara da Arrumação em ecrã inteiro */
.scan-camera-botoes { position: absolute; top: 8px; right: 8px; display: flex; gap: 8px; z-index: 2; }
.scan-camera-btn {
    width: 40px; height: 40px; border-radius: 50%; border: 0; display: grid; place-items: center;
    background: rgba(0,0,0,.55); color: #fff; font-size: 26px; line-height: 1; cursor: pointer;
}
.scan-camera-btn:hover { background: rgba(0,0,0,.75); }
.scan-camera-resumo {
    position: absolute; left: 8px; top: 8px; right: 104px; z-index: 2; display: flex; flex-direction: column; gap: 2px;
    padding: 6px 10px; border-radius: 8px; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; line-height: 1.35;
}
.scan-camera-resumo:empty { display: none; }
.scan-camera-resumo b { font-weight: 700; }
.scan-camera-resumo .alvo { color: #f3d97a; font-weight: 700; }

.scan-camera.cheia {
    position: fixed; inset: 0; z-index: 5000; max-width: none; margin: 0; border-radius: 0; background: #000;
}
.scan-camera.cheia video { width: 100%; height: 100%; max-height: none; object-fit: cover; }
.scan-camera.cheia .scan-camera-estado { font-size: 15px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
.scan-camera.cheia .scan-camera-botoes { top: calc(8px + env(safe-area-inset-top)); right: 12px; }
.scan-camera.cheia .scan-camera-resumo { top: calc(8px + env(safe-area-inset-top)); left: 12px; font-size: 14px; }
.scan-camera.cheia .scan-mira { inset: 30% 8%; }
body.camera-cheia { overflow: hidden; }
body.camera-cheia #toast-container { z-index: 6000; }

/* Modo scanner (pistola de picking) */
.scan-estado {
    display: flex; align-items: center; gap: 10px; margin: -4px 0 12px; padding: 10px 14px; border-radius: 10px;
    background: var(--superficie-2); border: 1px dashed var(--verde); font-size: 14px; font-weight: 600;
}
.scan-estado::before {
    content: ""; width: 10px; height: 10px; border-radius: 50%; background: #2e9d4a; flex: 0 0 auto;
    box-shadow: 0 0 0 0 rgba(46,157,74,.6); animation: scanPulso 1.6s infinite;
}
.scan-estado.parado::before { background: #c28a00; animation: none; }
@keyframes scanPulso { 70% { box-shadow: 0 0 0 9px rgba(46,157,74,0); } 100% { box-shadow: 0 0 0 0 rgba(46,157,74,0); } }
#arr-btn-modo[aria-pressed="true"] { background: var(--verde); border-color: var(--verde); color: #fff; }
body.arr-modo-scanner #arr-btn-camera { display: none; }
body.arr-modo-scanner .scan-barra input { border-color: var(--verde); }
@media (prefers-reduced-motion: reduce) { .scan-estado::before { animation: none; } }
