:root {
  --fundo: #f4f6f8; --cartao: #fff; --texto: #1d2733; --suave: #5f6b78; --borda: #d5dbe1;
  --azul: #1f5fbf; --azul-escuro: #174a95; --vermelho: #c0392b; --amarelo: #fff4cc; --amarelo-borda: #e0b400;
  --verde: #1e8449;
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--fundo); color: var(--texto); }
[hidden] { display: none !important; }
button, .botao { font: inherit; padding: .55em 1em; border: 1px solid var(--borda); background: #fff; border-radius: 8px; cursor: pointer; color: var(--texto); text-decoration: none; display: inline-block; }
button:disabled { opacity: .6; cursor: wait; }
.primario { background: var(--azul); border-color: var(--azul); color: #fff; font-weight: 600; }
.primario:hover { background: var(--azul-escuro); }
.perigo { color: var(--vermelho); border-color: #e3b3ad; }
.link { border: 0; background: none; color: var(--suave); text-decoration: underline; }
input, select, textarea { font: inherit; padding: .5em .6em; border: 1px solid var(--borda); border-radius: 8px; width: 100%; background: #fff; color: var(--texto); }
label { display: block; font-size: .9rem; color: var(--suave); margin-bottom: .7em; }
label input, label textarea { margin-top: .2em; color: var(--texto); }
.cartao { background: var(--cartao); border: 1px solid var(--borda); border-radius: 12px; padding: 1.2em; }
.erro { color: var(--vermelho); font-size: .9rem; min-height: 1em; margin: .3em 0 0; display: block; }
.aviso { background: #eef4fd; border: 1px solid #c4d7f2; padding: .6em .8em; border-radius: 8px; font-size: .9rem; }
.alerta { background: #fdecea; border: 1px solid #f1b0a8; color: #8e2318; padding: .6em .8em; border-radius: 8px; font-size: .9rem; font-weight: 600; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: 100%; max-width: 360px; }
.login h1 { font-size: 1.3rem; margin-top: 0; }
.login button { width: 100%; margin-top: .5em; }

header { display: flex; align-items: center; gap: 1em; padding: .6em 16px; background: #fff; border-bottom: 1px solid var(--borda); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.marca { color: var(--azul); }
nav { display: flex; gap: .3em; flex: 1; flex-wrap: wrap; }
.aba { border: 0; background: none; border-radius: 6px; padding: .45em .8em; }
.aba.ativa { background: #e6eefb; color: var(--azul); font-weight: 600; }
.contador { background: var(--vermelho); color: #fff; border-radius: 999px; padding: 0 .5em; font-size: .8rem; }
main { padding: 16px; max-width: 1200px; margin: 0 auto; }
h2 { font-size: 1.2rem; }

.soltar { display: flex; flex-direction: column; align-items: center; gap: .5em; text-align: center; border: 2px dashed #a9b7c6; border-radius: 12px; padding: 2.5em 1em; background: #fff; cursor: pointer; color: var(--suave); }
.soltar.arrastando { border-color: var(--azul); background: #eef4fd; }
.soltar input { display: none; }
.grande { font-size: 1.2rem; color: var(--azul); font-weight: 600; }
.lista-envio { list-style: none; padding: 0; }
.lista-envio li { background: #fff; border: 1px solid var(--borda); border-radius: 8px; padding: .5em .8em; margin-bottom: .4em; display: flex; justify-content: space-between; gap: 1em; font-size: .9rem; }
.ok { color: var(--verde); } .falhou { color: var(--vermelho); }

.fila { display: flex; gap: .4em; overflow-x: auto; padding-bottom: .6em; margin-bottom: .8em; }
.fila button { flex: 0 0 auto; font-size: .85rem; padding: .35em .7em; }
.fila button.atual { border-color: var(--azul); background: #e6eefb; font-weight: 600; }
.fila .st-erro { color: var(--vermelho); } .fila .st-lendo { color: var(--suave); }
.vazio { color: var(--suave); text-align: center; padding: 2em 0; }

.conferencia { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 1em; align-items: start; }
.foto-box { background: #222; border-radius: 12px; overflow: hidden; position: sticky; top: 4em; }
.foto-box img { width: 100%; max-height: 75vh; object-fit: contain; display: block; transition: transform .2s; background: #222; }
.foto-botoes { display: flex; justify-content: space-between; align-items: center; padding: .4em; background: #333; }
.foto-botoes a { color: #fff; font-size: .9rem; }
.linha { display: flex; gap: .8em; }
.linha label { flex: 1; } .linha .cresce { flex: 3; } .linha .uf { flex: 0 0 5em; }
.duvidoso input { background: var(--amarelo); border-color: var(--amarelo-borda); border-width: 2px; }
.duvidoso::after { content: "⚠ Confira este campo"; display: block; color: #8a6d00; font-size: .8rem; margin-top: .15em; }
.check { display: flex; gap: .5em; align-items: center; color: var(--texto); font-size: 1rem; background: #f6f8fa; padding: .6em; border-radius: 8px; }
.check input { width: 1.3em; height: 1.3em; margin: 0; }
.acoes { display: flex; gap: .5em; flex-wrap: wrap; }
.acoes .primario { flex: 1; }
hr { border: 0; border-top: 1px solid var(--borda); margin: 1em 0; }

.filtros { display: flex; gap: .5em; flex-wrap: wrap; margin-bottom: .6em; }
.filtros input { flex: 1 1 220px; width: auto; }
.filtros select { flex: 0 1 160px; width: auto; }
.total { color: var(--suave); font-size: .9rem; margin: .3em 0; }
.tabela-box { overflow-x: auto; background: #fff; border: 1px solid var(--borda); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: .55em .7em; border-bottom: 1px solid #edf0f3; white-space: nowrap; }
th { background: #f6f8fa; font-weight: 600; }
td.nome { white-space: normal; min-width: 180px; }
.rep { background: #fdecea; color: #8e2318; font-size: .75rem; padding: .1em .4em; border-radius: 4px; margin-left: .3em; }

@media (max-width: 760px) {
  .conferencia { grid-template-columns: 1fr; }
  .foto-box { position: static; }
  .foto-box img { max-height: 50vh; }
  header { gap: .3em; justify-content: space-between; }
  header nav { order: 3; flex: 1 0 100%; justify-content: space-between; }
  .aba { padding: .45em .5em; }
  .acoes button { white-space: nowrap; }
}
