/* Estoque com bipagem inteligente. Reaproveita as variaveis do index.html. */

.est-head{display:flex;align-items:center;gap:14px;margin-bottom:20px;flex-wrap:wrap}
.est-head h2{font-size:18px;font-weight:800;margin:0}
.est-head p{font-size:12.5px;color:var(--texto-suave);margin:2px 0 0}
.est-head .acts{margin-left:auto;display:flex;gap:9px;flex-wrap:wrap}
.est-btn{border:none;border-radius:10px;padding:10px 15px;font-weight:600;font-family:inherit;
  font-size:13px;cursor:pointer;display:inline-flex;align-items:center;gap:8px;transition:.14s}
.est-btn svg{width:16px;height:16px}
.est-primary{background:var(--vermelho);color:#fff}.est-primary:hover{background:#b91419}
.est-ghost{background:var(--card);color:var(--azul);border:1px solid var(--linha)}.est-ghost:hover{background:#e9eef8}

.est-cod{font-family:'SFMono-Regular',Consolas,monospace;font-size:12px;color:var(--texto-suave)}
.est-vinc{font-size:11px;font-weight:600;padding:3px 8px;border-radius:20px;background:#EAF0FB;color:var(--azul)}
.est-vinc.zero{background:#FDF3E1;color:var(--ambar)}

/* Overlay generico do estoque */
.est-ov{position:fixed;inset:0;background:rgba(20,33,61,.5);backdrop-filter:blur(2px);
  display:none;align-items:center;justify-content:center;z-index:60;padding:20px}
.est-ov.open{display:flex}
.est-modal{background:var(--card);border-radius:16px;width:100%;max-width:520px;max-height:90vh;
  overflow-y:auto;box-shadow:0 20px 60px rgba(20,33,61,.3)}
.est-mhead{padding:18px 22px;border-bottom:1px solid var(--linha);display:flex;align-items:center;gap:12px}
.est-mhead .ic{width:40px;height:40px;border-radius:11px;background:var(--azul);color:#fff;
  display:flex;align-items:center;justify-content:center;flex-shrink:0}
.est-mhead .ic svg{width:20px;height:20px}
.est-mhead h3{font-size:16px;font-weight:700;margin:0}
.est-mhead .sub{font-size:12px;color:var(--texto-suave)}
.est-mhead .x{margin-left:auto;background:none;border:none;font-size:20px;color:var(--texto-suave);cursor:pointer;line-height:1}
.est-mbody{padding:20px 22px}

/* Toggle entrada/saida */
.est-toggle{display:flex;background:var(--bg);border:1px solid var(--linha);border-radius:11px;padding:4px;margin-bottom:16px}
.est-toggle button{flex:1;border:none;background:none;padding:10px;border-radius:8px;font-family:inherit;
  font-size:13px;font-weight:600;color:var(--texto-suave);cursor:pointer;display:flex;align-items:center;justify-content:center;gap:7px}
.est-toggle button svg{width:15px;height:15px}
.est-toggle button.on-in{background:#E7F7EF;color:var(--verde)}
.est-toggle button.on-out{background:#FDECEC;color:var(--vermelho)}

.est-field{margin-bottom:12px}
.est-field label{display:block;font-size:11.5px;font-weight:600;color:var(--texto-suave);margin-bottom:6px}
.est-field input,.est-field select{width:100%;border:1px solid var(--linha);border-radius:10px;padding:11px 13px;
  font-family:inherit;font-size:13.5px;color:var(--texto);background:var(--bg);outline:none}
.est-field input:focus,.est-field select:focus{border-color:var(--azul);background:#fff}
.est-scan-row{display:flex;gap:8px}
.est-scan-row input{flex:1}
.est-gun input{font-size:16px;padding:13px 14px;font-weight:600}
.est-gun-hint{font-size:11.5px;color:var(--texto-suave);margin-top:8px;line-height:1.45}
.est-alt{margin-top:16px;padding-top:14px;border-top:1px solid var(--linha)}

/* Camera */
.est-cam{position:relative;border-radius:12px;overflow:hidden;background:#0C1020}
.est-cam:empty{display:none}
.est-cam video{width:100%;max-height:240px;display:block;object-fit:cover}
.est-camline{position:absolute;left:8%;right:8%;top:50%;height:2px;background:var(--vermelho);
  box-shadow:0 0 10px 1px rgba(215,25,32,.7);animation:estscan 1.8s ease-in-out infinite}
@keyframes estscan{0%{top:22%}50%{top:78%}100%{top:22%}}
.est-caminfo{padding:10px 12px;font-size:12px;color:var(--texto-suave);background:var(--bg);border-radius:0 0 12px 12px;line-height:1.5}

.est-log{margin-top:16px;max-height:190px;overflow-y:auto}
.est-log .row{display:flex;gap:10px;padding:9px 0;border-bottom:1px solid var(--linha);align-items:center;font-size:12.5px}
.est-log .row:last-child{border:none}
.est-log .b{width:26px;height:26px;border-radius:8px;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.est-log .b svg{width:14px;height:14px}
.est-log .ok{background:#E7F7EF;color:var(--verde)}
.est-log .out{background:#FDECEC;color:var(--vermelho)}
.est-log .new{background:#FDF3E1;color:var(--ambar)}
.est-log small{color:var(--texto-suave)}

/* Painel de vincular codigo novo */
.est-vpanel{margin-top:14px;border:1px dashed var(--azul);border-radius:12px;padding:14px;background:#F8FAFE}
.est-vpanel .tt{font-size:12.5px;font-weight:700;color:var(--azul);margin-bottom:4px;display:flex;gap:7px;align-items:center}
.est-vpanel .tt svg{width:15px;height:15px}
.est-vpanel .code{font-family:monospace;font-size:12px;color:var(--texto-suave);margin-bottom:10px}
.est-results{max-height:170px;overflow-y:auto;margin-top:4px}
.est-presult{padding:10px 12px;border:1px solid var(--linha);border-radius:9px;background:#fff;margin-bottom:7px;cursor:default}
.est-presult .pn{font-size:13px;font-weight:700}
.est-presult .pm{display:flex;gap:6px;flex-wrap:wrap;margin-top:8px}
.est-presult .pm button{border:1px solid var(--linha);background:var(--bg);color:var(--azul);border-radius:20px;
  padding:5px 11px;font-size:11.5px;font-weight:600;cursor:pointer;font-family:inherit}
.est-presult .pm button:hover{background:#e9eef8}

/* Cadastro: linhas de medida */
.med-row{display:grid;grid-template-columns:1fr 1.1fr .9fr auto;gap:8px;margin-bottom:8px;align-items:center}
.med-row input,.med-row select{border:1px solid var(--linha);border-radius:9px;padding:9px 10px;font-family:inherit;font-size:12.5px;background:var(--bg)}
.med-row .del{background:none;border:none;color:var(--vermelho);cursor:pointer;font-size:16px}
.med-add{background:none;border:1px dashed var(--linha);color:var(--azul);border-radius:9px;padding:9px;
  width:100%;font-family:inherit;font-size:12.5px;font-weight:600;cursor:pointer;margin-top:2px}
