:root{--bg:#0d0f14;--panel:#171a22;--panel2:#20242e;--red:#e01f2d;--text:#f4f4f5;--muted:#a5a8b3;--line:#333846;--green:#24b26b;--yellow:#f0b429;--blue:#3d8bfd;--whats:#25d366;--input:#0f131b;--shadow:rgba(0,0,0,.28)}
:root[data-theme="light"]{--bg:#f4f6fa;--panel:#ffffff;--panel2:#f1f4f8;--text:#111827;--muted:#5b6472;--line:#d7dce5;--input:#ffffff;--shadow:rgba(15,23,42,.12)}
*{box-sizing:border-box}body{margin:0;font-family:Arial,Helvetica,sans-serif;background:var(--bg);color:var(--text)}button,input,select{font:inherit}a{color:inherit}.sidebar{position:fixed;left:0;top:0;bottom:0;width:250px;background:linear-gradient(180deg,var(--panel),var(--panel2));border-right:1px solid var(--line);padding:22px;display:flex;flex-direction:column;gap:14px}.logo-wrap{background:#fff;border-radius:18px;padding:12px;min-height:80px;display:flex;align-items:center;justify-content:center}.logo-wrap img{max-width:180px;max-height:80px}.sidebar h1{font-size:22px;margin:0}.version-badge{display:inline-block;background:var(--red);color:#fff;border-radius:999px;padding:6px 12px;font-weight:700;font-size:13px;width:max-content}.sidebar nav{display:flex;flex-direction:column;gap:8px;margin-top:8px}.sidebar nav button,.sidebar-whatsapp{border:1px solid var(--line);background:transparent;color:var(--text);border-radius:12px;padding:12px;text-align:left;cursor:pointer;text-decoration:none}.sidebar nav button.active,.sidebar nav button:hover{background:var(--red);color:#fff}.sidebar-whatsapp{margin-top:auto;border-color:rgba(37,211,102,.55)}.sidebar-whatsapp small{display:block;color:var(--muted);margin-top:4px}.main{margin-left:250px;padding:22px}.login-bar{display:flex;justify-content:space-between;gap:14px;align-items:center;padding:12px 16px;border:1px solid var(--line);background:var(--panel);border-radius:16px;margin-bottom:18px;position:sticky;top:10px;z-index:2}.section{display:none}.active-section{display:block}.topbar{display:flex;justify-content:space-between;gap:16px;align-items:flex-start;margin-bottom:18px}.topbar h2{margin:0 0 6px}.topbar p{margin:0;color:var(--muted)}.top-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap}.cards{display:grid;grid-template-columns:repeat(5,minmax(150px,1fr));gap:14px;margin-bottom:18px}.card,.panel{background:var(--panel);border:1px solid var(--line);border-radius:18px;box-shadow:0 14px 35px var(--shadow)}.card{padding:18px}.card span{display:block;color:var(--muted);font-size:13px;margin-bottom:8px}.card strong{font-size:25px}.valor-card strong{color:var(--green)}.panel{padding:18px;margin-bottom:18px}.panel h3{margin:0 0 12px}.hint,.small-note{color:var(--muted);font-size:13px}input,select{background:var(--input);border:1px solid var(--line);color:var(--text);border-radius:12px;padding:10px 12px;outline:none;min-height:42px}label{display:flex;flex-direction:column;gap:6px;font-weight:700;font-size:13px;color:var(--muted)}button{border:1px solid var(--line);background:var(--panel2);color:var(--text);padding:10px 14px;border-radius:12px;cursor:pointer}button:hover{filter:brightness(1.08)}.primary{background:var(--red);border-color:var(--red);color:#fff;font-weight:700}.secondary{background:var(--blue);border-color:var(--blue);color:#fff}.danger{background:#7f1d1d;border-color:#991b1b;color:#fff}.full{width:100%;text-align:center}.theme-toggle{padding:7px 10px}.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:18px}.form-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin-bottom:14px}.user-grid{grid-template-columns:repeat(5,1fr)}.lote-list,.dashboard-lotes{display:grid;gap:10px}.dashboard-lotes{grid-template-columns:repeat(3,1fr)}.dashboard-lotes button,.lote-item,.request-item{background:var(--panel2);border:1px solid var(--line);border-radius:14px;padding:12px}.dashboard-lotes button{text-align:left}.dashboard-lotes span,.lote-item small,.request-item small{display:block;color:var(--muted);margin-top:5px}.lote-item{display:flex;justify-content:space-between;gap:10px;align-items:center}.lote-item>div:last-child{display:flex;gap:8px;flex-wrap:wrap}.table-wrap{overflow:auto;background:var(--panel);border:1px solid var(--line);border-radius:18px}table{border-collapse:collapse;width:100%;min-width:1280px;table-layout:fixed}th,td{border-bottom:1px solid var(--line);padding:6px;text-align:left;vertical-align:middle}th{position:sticky;top:0;background:var(--panel2);z-index:1;font-size:11px;color:var(--muted);white-space:nowrap}td input{width:100%;padding:6px;min-height:32px;border-radius:8px}.col-num{width:36px}.col-codigo{width:126px}.col-descricao{width:240px}.col-aplicacao{width:48px;text-align:center}.col-qtd{width:72px}.col-valor{width:92px}.col-check{width:62px;text-align:center}.col-obs{width:118px}.col-acoes{width:78px}.td-aplicacao input,.aplicacao-mini{text-align:center;text-transform:uppercase}.td-qtd input,.qtd-input{text-align:center}.td-codigo input,.codigo-input{font-variant-numeric:tabular-nums}.descricao-input{min-width:0}.valor-input{font-variant-numeric:tabular-nums}.obs-input{min-width:0}.btn-mini{padding:7px 9px;font-size:12px}.wide{width:220px!important}.center{text-align:center}.center input{width:auto}pre{white-space:pre-wrap;line-height:1.6;background:var(--panel2);border-radius:14px;padding:18px}.alert{border-radius:12px;padding:10px 12px;margin-bottom:12px}.alert.error{background:#7f1d1d;color:#fff}.alert.ok{background:#14532d;color:#fff}.login-page{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px;background:radial-gradient(circle at top left,rgba(224,31,45,.20),transparent 34%),linear-gradient(135deg,#070b14 0%,#0d111c 52%,#10131f 100%);color:#f8fafc}.login-shell{width:min(100%,1040px);min-height:580px;display:grid;grid-template-columns:1.05fr .95fr;overflow:hidden;border-radius:28px;border:1px solid rgba(255,255,255,.10);box-shadow:0 30px 90px rgba(0,0,0,.42);background:#0d111c}.login-brand{padding:42px;background:linear-gradient(160deg,rgba(224,31,45,.16),rgba(255,255,255,.03));display:flex;flex-direction:column;justify-content:center}.login-brand img{width:230px;background:#fff;border-radius:18px;padding:12px;margin-bottom:24px}.login-brand h1{font-size:42px;margin:0}.login-brand strong{color:#fff;background:#e01f2d;border-radius:999px;padding:7px 14px;width:max-content;margin:12px 0}.login-brand p{color:#cbd5e1;line-height:1.5}.feature-list{display:grid;gap:9px;margin-top:18px}.feature-list span{background:rgba(255,255,255,.08);padding:10px;border-radius:12px}.login-card{background:#fff;color:#111827;padding:42px;display:flex;flex-direction:column;justify-content:center}.login-card input{background:#f8fafc;color:#111827;border-color:#d1d5db}.login-card label{color:#374151}.login-form{display:grid;gap:14px}.password-row{display:flex;gap:8px}.password-row input{flex:1}.eye-btn{width:54px;background:#f3f4f6;color:#111827}.link-btn{background:transparent;border:0;color:#e01f2d;margin-top:12px;text-align:left;padding-left:0}.recovery-form{display:none;margin-top:14px;border-top:1px solid #e5e7eb;padding-top:14px}.show-recovery .recovery-form{display:grid;gap:10px}.small-note{margin-top:16px;color:#6b7280}@media(max-width:980px){.sidebar{position:static;width:auto}.main{margin-left:0}.cards{grid-template-columns:repeat(2,1fr)}.grid-2,.login-shell{grid-template-columns:1fr}.form-grid,.user-grid,.dashboard-lotes{grid-template-columns:1fr}.topbar,.login-bar,.lote-item{flex-direction:column;align-items:stretch}.login-brand{display:none}}@media print{.sidebar,.login-bar,.top-actions,button{display:none!important}.main{margin:0;padding:0}.section{display:none}.active-section{display:block}.panel,.card{box-shadow:none}}

/* V9.2 - Destaque automático: quando ANUNCIADO for marcado, a linha fica amarela */
tr.linha-anunciada td{background:#fff200!important;color:#000!important;}
tr.linha-anunciada td input{background:#fff200!important;color:#000!important;border-color:#222!important;font-weight:700;}
tr.linha-anunciada td input[type="checkbox"]{accent-color:#e01f2d;}
tr.linha-anunciada .btn-mini{background:#7f1d1d!important;color:#fff!important;}


/* V9.3 - tabela operacional compacta para tela de PC */
table{min-width:1120px;table-layout:fixed;}
.col-num{width:32px}.col-codigo{width:120px}.col-desc{width:170px}.col-qtd{width:62px}.col-valor{width:92px}.col-check{width:56px;text-align:center}.col-obs{width:210px}.col-acoes{width:72px}
th.col-check{font-size:10px;white-space:normal;line-height:1.05;text-align:center;}
td{padding:5px;}td input{padding:5px 7px;min-height:30px;border-radius:8px;}
.codigo-input{max-width:108px;font-variant-numeric:tabular-nums;}
.descricao-input{max-width:160px;text-transform:uppercase;}
.qtd-input{max-width:52px;text-align:center;}
.valor-input{max-width:86px;font-variant-numeric:tabular-nums;}
.obs-input{max-width:200px;}
.center{text-align:center}.center input{width:14px;height:14px;}


/* V9.4 - ajustes solicitados para tela de PC */
table{min-width:1180px;table-layout:fixed;}
.col-codigo{width:165px!important;}
.col-desc{width:178px!important;}
.col-qtd{width:86px!important;}
.col-valor{width:96px!important;}
.col-check{width:56px!important;text-align:center;}
.col-obs{width:210px!important;}
.codigo-input{max-width:152px!important;min-width:152px!important;font-variant-numeric:tabular-nums;}
.qtd-input{max-width:72px!important;min-width:72px!important;text-align:center;font-variant-numeric:tabular-nums;}
.descricao-input{max-width:168px!important;text-transform:uppercase;}
.valor-input{max-width:88px!important;font-variant-numeric:tabular-nums;}

/* Cores automáticas por marcador. Prioridade no script: Despacho > Anunciado > Recebido */
tr.linha-recebida td{background:#d9fdd3!important;color:#000!important;}
tr.linha-recebida td input{background:#d9fdd3!important;color:#000!important;border-color:#257a36!important;font-weight:700;}
tr.linha-anunciada td{background:#fff200!important;color:#000!important;}
tr.linha-anunciada td input{background:#fff200!important;color:#000!important;border-color:#222!important;font-weight:700;}
tr.linha-despacho td{background:#ffd6d6!important;color:#000!important;}
tr.linha-despacho td input{background:#ffd6d6!important;color:#000!important;border-color:#a83232!important;font-weight:700;}
tr.linha-recebida td input[type="checkbox"],tr.linha-anunciada td input[type="checkbox"],tr.linha-despacho td input[type="checkbox"]{background:initial!important;width:14px;height:14px;}
tr.linha-despacho .btn-mini{background:#7f1d1d!important;color:#fff!important;}


/* V9.5 - ajustes finos da tabela operacional */
table{min-width:1090px!important;table-layout:fixed!important;}
.table-wrap{max-height:calc(100vh - 210px);overflow:auto;position:relative;}
.table-wrap thead th{position:sticky!important;top:0!important;z-index:10!important;background:var(--panel2)!important;box-shadow:0 2px 0 var(--line);}
.col-codigo{width:166px!important;}
.col-desc{width:176px!important;}
.col-qtd{width:82px!important;}
.col-valor{width:96px!important;}
.col-check{width:54px!important;text-align:center!important;}
.col-obs{width:150px!important;}
.col-acoes{width:58px!important;text-align:center!important;}
.codigo-input{max-width:154px!important;min-width:154px!important;}
.qtd-input{max-width:68px!important;min-width:68px!important;text-align:center!important;}
.obs-input{max-width:140px!important;min-width:140px!important;}
th.col-check{font-size:10px!important;white-space:normal!important;line-height:1.05!important;text-align:center!important;}
.btn-mini{padding:6px 7px!important;font-size:11px!important;}
tr.linha-despacho td{background:#b00000!important;color:#fff!important;}
tr.linha-despacho td input{background:#b00000!important;color:#fff!important;border-color:#ffb3b3!important;font-weight:700!important;}
tr.linha-despacho td input[type="checkbox"]{accent-color:#fff;}


/* V9.6 - força cor vermelho sangue no Desp. e corrige cache */
body table tbody tr.linha-despacho,
body table tbody tr.linha-despacho td{background:#8b0000!important;color:#ffffff!important;}
body table tbody tr.linha-despacho input:not([type=checkbox]){background:#8b0000!important;color:#ffffff!important;border-color:#ffb3b3!important;font-weight:700!important;}
body table tbody tr.linha-despacho input[type=checkbox]{accent-color:#ffffff!important;}
body table tbody tr.linha-despacho .btn-mini{background:#5f0000!important;color:#fff!important;border-color:#5f0000!important;}


/* V9.7 - cabeçalho da grade de peças fixo durante a rolagem */
body.secao-pecas{overflow:hidden!important;}
body.secao-pecas .main{height:100vh!important;overflow:hidden!important;padding-bottom:12px!important;}
body.secao-pecas #pecas.active-section{height:calc(100vh - 92px)!important;display:flex!important;flex-direction:column!important;min-height:0!important;}
body.secao-pecas #pecas .topbar{flex:0 0 auto!important;margin-bottom:10px!important;}
body.secao-pecas #pecas .table-wrap{flex:1 1 auto!important;min-height:0!important;max-height:none!important;overflow:auto!important;position:relative!important;border-radius:12px!important;}
body.secao-pecas #pecas .table-wrap thead th{position:sticky!important;top:0!important;z-index:50!important;background:var(--panel2)!important;box-shadow:0 2px 0 var(--line),0 4px 10px rgba(0,0,0,.35)!important;}
body.secao-pecas #pecas table{min-width:1090px!important;}
body.secao-pecas .login-bar{z-index:100!important;}
@media(max-width:980px){body.secao-pecas{overflow:auto!important;}body.secao-pecas .main{height:auto!important;overflow:visible!important;}body.secao-pecas #pecas.active-section{height:auto!important;display:block!important;}body.secao-pecas #pecas .table-wrap{max-height:70vh!important;overflow:auto!important;}}

/* V9.8 - tabela mais compacta no PC e Desp. restrito ao administrador */
table{width:1268px!important;min-width:1268px!important;max-width:1268px!important;table-layout:fixed!important;}
th,td{padding-left:4px!important;padding-right:4px!important;}
.col-num{width:32px!important;}
.col-codigo{width:168px!important;}
.col-desc{width:178px!important;}
.col-qtd{width:82px!important;}
.col-valor{width:96px!important;}
.col-check{width:58px!important;text-align:center!important;}
.col-obs{width:148px!important;}
.col-acoes{width:58px!important;text-align:center!important;}
.codigo-input{max-width:152px!important;min-width:152px!important;}
.descricao-input{max-width:160px!important;min-width:160px!important;}
.qtd-input{max-width:68px!important;min-width:68px!important;}
.valor-input{max-width:86px!important;min-width:86px!important;}
.obs-input{max-width:136px!important;min-width:136px!important;}
td.center{padding-left:2px!important;padding-right:2px!important;}
td.center input[type=checkbox]{width:14px!important;height:14px!important;}
input[type=checkbox]:disabled{opacity:.35;cursor:not-allowed;}
body.secao-pecas #pecas .table-wrap{overflow:auto!important;}
body.secao-pecas #pecas .table-wrap thead th{position:sticky!important;top:0!important;z-index:80!important;}


/* V10.1 - recuperação de senha com exclusão de solicitações */
.recovery-admin-panel{border-color:#f59e0b!important;box-shadow:0 0 0 1px rgba(245,158,11,.25) inset;}
.request-item{display:flex;justify-content:space-between;gap:12px;align-items:center;border:1px solid var(--line);background:var(--panel2);border-radius:14px;padding:12px 14px;margin:8px 0;}
.request-item b{display:block;font-size:15px;margin-bottom:4px;}
.request-item small{display:block;color:var(--muted);line-height:1.35;}
.request-match{margin-top:4px;color:#86efac!important;}
.request-match.warn{color:#fca5a5!important;}
.request-item.request-resolved{opacity:.62;}
.request-item.request-resolved b{text-decoration:line-through;}
.request-item button{white-space:nowrap;}
@media(max-width:980px){.request-item{flex-direction:column;align-items:stretch;}}

.request-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;justify-content:flex-end;}


/* V10.9 - Cor da linha por marcador: Lançado azul claro e Anunciado amarelo */
body table tbody tr.linha-lancada,
body table tbody tr.linha-lancada td{background:#dbeafe!important;color:#000000!important;}
body table tbody tr.linha-lancada input:not([type=checkbox]){background:#dbeafe!important;color:#000000!important;border-color:#3b82f6!important;font-weight:700!important;}
body table tbody tr.linha-lancada input[type=checkbox]{accent-color:#2563eb!important;}
body table tbody tr.linha-lancada .btn-mini{background:#1d4ed8!important;color:#fff!important;border-color:#1d4ed8!important;}

/* Mantém Anunciado com prioridade visual amarela acima do Lançado */
body table tbody tr.linha-anunciada,
body table tbody tr.linha-anunciada td{background:#fff200!important;color:#000000!important;}
body table tbody tr.linha-anunciada input:not([type=checkbox]){background:#fff200!important;color:#000000!important;border-color:#222!important;font-weight:700!important;}
body table tbody tr.linha-anunciada input[type=checkbox]{accent-color:#e01f2d!important;}

/* V10.9 - filtros superiores da tela Peças */
.pecas-filtros{gap:10px; align-items:center; flex-wrap:nowrap;}
#filtroStatusPeca{min-width:135px; max-width:150px;}
@media(max-width:900px){.pecas-filtros{flex-wrap:wrap;} #filtroStatusPeca{min-width:100%;}}

/* V11.1 - Leitor OCR por câmera */
.btn-camera{background:#111827!important;border-color:#e11d48!important;}
.modal-ocr{display:none;position:fixed;inset:0;background:rgba(0,0,0,.78);z-index:9999;align-items:center;justify-content:center;padding:18px;}
.modal-ocr.active{display:flex;}
.modal-ocr-box{width:min(720px,96vw);max-height:92vh;overflow:auto;background:var(--panel);border:1px solid var(--line);border-radius:20px;padding:18px;box-shadow:0 25px 80px rgba(0,0,0,.55);}
.modal-ocr-head{display:flex;justify-content:space-between;gap:14px;align-items:flex-start;margin-bottom:12px;}
.modal-ocr-head h3{margin:0 0 4px;font-size:20px;}
.modal-ocr-head p{margin:0;color:var(--muted);font-size:13px;line-height:1.35;}
.modal-close{font-size:24px;line-height:1;width:42px;height:42px;border-radius:12px;padding:0;}
#ocrVideo{width:100%;max-height:48vh;background:#050505;border-radius:14px;border:1px solid var(--line);object-fit:contain;}
.ocr-actions,.ocr-manual{display:flex;gap:10px;align-items:end;flex-wrap:wrap;margin-top:12px;}
.ocr-manual label{flex:1;min-width:240px;}
.ocr-resultado{margin-top:12px;padding:12px;border-radius:12px;background:var(--panel2);border:1px solid var(--line);font-size:14px;line-height:1.4;}
@media(max-width:700px){.ocr-actions button,.ocr-manual button{width:100%;}.modal-ocr-box{padding:14px;}#ocrVideo{max-height:42vh;}}

/* V11.7 - Lotes finalizados e filtro maior quantidade */
.lote-finalizado-select{
  min-width:260px!important;
  max-width:360px!important;
  border-color:#f59e0b!important;
  background:var(--panel2)!important;
  font-weight:700!important;
}
.lote-status{
  display:inline-block;
  margin-left:8px;
  padding:3px 8px;
  border-radius:999px;
  font-size:11px;
  vertical-align:middle;
}
.lote-status.ativo{background:#064e3b;color:#bbf7d0;}
.lote-status.finalizado{background:#78350f;color:#fde68a;}
.lote-list-title{
  margin:18px 0 8px;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.04em;
  font-size:12px;
}
.lote-finalizado-item{border-color:#f59e0b!important; opacity:.92;}
.dashboard-lotes button em{
  font-style:normal;
  margin-left:8px;
  font-size:11px;
  color:#fde68a;
  background:#78350f;
  border-radius:999px;
  padding:2px 6px;
}
.lote-finalizado-btn{border-color:#f59e0b!important;}
@media(max-width:1100px){.lote-finalizado-select{min-width:180px!important;max-width:100%!important;}}


.backup-list{display:flex;flex-direction:column;gap:8px}
.backup-item{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 14px;border:1px solid var(--border);border-radius:12px;background:var(--panel2)}
.backup-item b{display:block;font-size:14px}
.backup-item small{display:block;color:var(--muted);margin-top:3px}
.security-panel .hint{margin-bottom:12px}
