:root {
  --bg: #E4E6E1;
  --panel: #FFFFFF;
  --ink: #1B211F;
  --ink2: #5B635F;
  --line: #C8CCC5;
  --line-soft: #E1E4DE;
  --green: #14453C;
  --green-forte: #0D2F29;
  --amber: #D99A07;
  --red: #A5331E;
  --sombra-sm: 0 1px 2px rgba(27, 33, 31, .06);
  --sombra-md: 0 4px 14px rgba(27, 33, 31, .08);
  --sombra-lg: 0 16px 40px rgba(27, 33, 31, .16);
  --raio: 10px;
  --rapido: 150ms cubic-bezier(.4, 0, .2, 1);
  --medio: 250ms cubic-bezier(.4, 0, .2, 1);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button {
  font-family: inherit;
  cursor: pointer;
  transition: transform var(--rapido), box-shadow var(--rapido), background var(--rapido), color var(--rapido), border-color var(--rapido);
}
button:active:not(:disabled) { transform: scale(.96); }
input, select, textarea { transition: border-color var(--rapido), box-shadow var(--rapido); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(20, 69, 60, .12);
}
.escondido { display: none !important; }
.detalhe { color: var(--ink2); font-size: 12px; }
.detalhe.forte { font-weight: 600; color: #7A5502; }
.link { background: none; border: none; text-decoration: underline; color: var(--ink2); font-size: 12px; padding: 0; }
.link:hover { color: var(--green); }
.vazio-simples { padding: 24px; text-align: center; color: var(--ink2); font-size: 13px; }
.icone { display: inline-block; vertical-align: -3px; flex-shrink: 0; }
button .icone, .link-historico .icone, .rotulo .icone, .campo-busca .icone { margin-right: 6px; }

/* ---- animacoes ---- */
@keyframes entrar-fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes entrar-cima {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes girar { to { transform: rotate(360deg); } }
@keyframes pulsar-numero {
  0% { transform: scale(1); }
  30% { transform: scale(1.18); color: var(--green); }
  100% { transform: scale(1); }
}
@keyframes destaque-card {
  0% { box-shadow: 0 0 0 3px rgba(20, 69, 60, .35); }
  100% { box-shadow: var(--sombra-sm); }
}
@keyframes surgir-modal {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes surgir-overlay {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes pontinho {
  0%, 100% { opacity: 1; } 50% { opacity: .35; }
}
.entra { animation: entrar-fade var(--medio) both; }
.entra-toast { animation: entrar-cima var(--medio) both; }
.girando { animation: girar .8s linear infinite; }
.pulsar { animation: pulsar-numero .5s ease; }
.destacado { animation: destaque-card 1.4s ease-out; }

/* ---- botoes ---- */
.botao-primario, .botao-secundario, .botao-perigo, .botao-ambar, .botao-verde-claro, .botao-icone {
  border-radius: 8px; padding: 9px 15px; font-size: 13px; font-weight: 600; border: 1px solid transparent;
  display: inline-flex; align-items: center; box-shadow: var(--sombra-sm);
}
.botao-primario { background: var(--green); color: #fff; }
.botao-primario:hover:not(:disabled) { background: var(--green-forte); box-shadow: var(--sombra-md); transform: translateY(-1px); }
.botao-secundario { background: var(--panel); color: var(--ink); border-color: var(--line); }
.botao-secundario:hover:not(:disabled) { border-color: var(--green); color: var(--green); box-shadow: var(--sombra-md); transform: translateY(-1px); }
.botao-perigo { background: var(--red); color: #fff; }
.botao-perigo:hover:not(:disabled) { background: #832A18; box-shadow: var(--sombra-md); transform: translateY(-1px); }
.botao-ambar { background: #FBF0D6; color: #7A5502; border-color: #EDD79A; }
.botao-ambar:hover:not(:disabled) { background: #F7E4B8; box-shadow: var(--sombra-md); transform: translateY(-1px); }
.botao-verde-claro { background: #E6EDEA; color: var(--green); border-color: #BFD2CB; }
.botao-verde-claro:hover:not(:disabled) { background: #D8E5DF; box-shadow: var(--sombra-md); transform: translateY(-1px); }
.botao-icone { background: var(--panel); border-color: var(--line); color: var(--ink2); padding: 9px 11px; }
.botao-icone:hover:not(:disabled) { color: var(--green); border-color: var(--green); box-shadow: var(--sombra-md); transform: translateY(-1px); }
.botao-icone.perigo:hover:not(:disabled) { color: var(--red); border-color: var(--red); }
button:disabled { opacity: .5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
button.carregando span { visibility: hidden; }
button.carregando { position: relative; }
button.carregando::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, .5); border-top-color: #fff; border-radius: 50%; animation: girar .6s linear infinite;
}

/* ---- login ---- */
#tela-login { position: relative; min-height: 100vh; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.fundo-login {
  position: absolute; inset: 0;
  background:
    radial-gradient(60% 50% at 15% 10%, rgba(217, 154, 7, .18), transparent 60%),
    radial-gradient(70% 60% at 85% 90%, rgba(20, 69, 60, .35), transparent 60%),
    linear-gradient(160deg, var(--green-forte), var(--green) 60%, #1c5347);
}
.painel-login {
  position: relative; width: 100%; max-width: 400px; margin: 0 16px; padding: 32px;
  background: var(--panel); border-radius: 16px; box-shadow: var(--sombra-lg);
  animation: surgir-modal var(--medio) both;
}
.marca-login {
  width: 48px; height: 48px; border-radius: 12px; background: var(--green); color: #fff;
  display: flex; align-items: center; justify-content: center; margin-bottom: 16px;
}
.painel-login h1 { font-size: 21px; font-weight: 800; color: var(--green-forte); margin: 0 0 4px; letter-spacing: -.02em; }
#form-login label { display: block; font-size: 13px; color: var(--ink2); margin: 14px 0 5px; }
#form-login input { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; background: #FBFBFA; }
#form-login button[type="submit"] {
  margin-top: 20px; width: 100%; padding: 11px; border: none; border-radius: 8px; background: var(--green);
  color: #fff; font-weight: 700; box-shadow: var(--sombra-sm);
}
#form-login button[type="submit"]:hover:not(:disabled) { background: var(--green-forte); box-shadow: var(--sombra-md); transform: translateY(-1px); }
#form-login .erro { display: flex; align-items: center; color: var(--red); font-size: 13px; margin-top: 12px; }

/* ---- layout geral ---- */
.pagina { max-width: 1100px; margin: 0 auto; padding: 20px 16px; }
.cabecalho { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.cabecalho h1 { font-size: 21px; font-weight: 800; letter-spacing: -.02em; color: var(--green-forte); margin: 0; }
.acoes-cabecalho { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.relative { position: relative; }
#badge-novidades { color: var(--red); font-weight: 700; font-size: 11px; }
.ponto-status { display: inline-block; width: 7px; height: 7px; border-radius: 99px; background: var(--green); margin-right: 6px; vertical-align: 1px; }
.ponto-status.ok { animation: pontinho 2.4s ease-in-out infinite; }
.ponto-status.offline { background: var(--red); }
#aviso .aviso { display: flex; align-items: center; background: #FBE9E4; color: var(--red); border: 1px solid #EFC5B9; padding: 9px 13px; border-radius: 8px; margin-bottom: 12px; font-size: 13px; box-shadow: var(--sombra-sm); }

.painel-flutuante { position: absolute; right: 0; top: calc(100% + 8px); width: 320px; max-height: 340px; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--sombra-lg); z-index: 40; animation: entrar-cima var(--rapido) both; }
.cabecalho-flutuante { display: flex; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); background: #FAFAF8; font-weight: 600; }
.cabecalho-flutuante button { background: none; border: none; color: var(--ink2); }
.linha-novidade { padding: 8px 14px; border-bottom: 1px solid var(--line-soft); font-size: 13px; transition: background var(--rapido); }
.linha-novidade:hover { background: #F7F7F4; }
.linha-novidade p { margin: 0; }

/* ---- resumo ---- */
.grid-resumo { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
@media (min-width: 640px) { .grid-resumo { grid-template-columns: repeat(4, 1fr); } }
.cartao-resumo {
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--raio); padding: 14px 16px;
  box-shadow: var(--sombra-sm); transition: transform var(--rapido), box-shadow var(--rapido), border-color var(--rapido);
}
.cartao-resumo:hover { transform: translateY(-2px); box-shadow: var(--sombra-md); border-color: var(--line); }
.cartao-resumo .rotulo { display: flex; align-items: center; font-size: 12px; color: var(--ink2); font-weight: 500; }
.cartao-resumo .valor { font-size: 26px; font-weight: 800; margin-top: 4px; letter-spacing: -.02em; display: inline-block; }

/* ---- filtros ---- */
.painel-filtros { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--raio); padding: 14px; margin-bottom: 12px; box-shadow: var(--sombra-sm); }
.campo-busca { position: relative; margin-bottom: 10px; color: var(--ink2); }
.campo-busca .icone { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); }
.campo-busca input { width: 100%; padding: 10px 12px 10px 36px; border: 1px solid var(--line); border-radius: 8px; }
.linha-filtros { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.linha-filtros select { padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: #FBFBFA; }
.grupo-medida { display: flex; align-items: center; gap: 6px; background: #F7F7F4; border: 1px solid var(--line-soft); border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.grupo-medida input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 5px; }

/* ---- abas ---- */
.abas { display: flex; gap: 4px; margin-bottom: 12px; flex-wrap: wrap; }
.aba { background: transparent; border: none; border-bottom: 2px solid transparent; padding: 9px 14px; color: var(--ink2); font-weight: 600; border-radius: 8px 8px 0 0; }
.aba:hover { background: rgba(255, 255, 255, .5); color: var(--ink); }
.aba.ativa { background: var(--panel); color: var(--ink); border-bottom-color: var(--amber); box-shadow: var(--sombra-sm); }

.faixa-reservado { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: #E6EDEA; border: 1px solid #BFD2CB; border-radius: var(--raio); padding: 11px 15px; margin-bottom: 12px; color: var(--green); font-size: 13px; }
.faixa-reservado span { display: flex; align-items: center; }

/* ---- vazio ---- */
.vazio { background: var(--panel); border: 1px dashed var(--line); border-radius: var(--raio); padding: 44px 20px; text-align: center; }
.vazio .titulo { font-weight: 600; margin-bottom: 12px; }

/* ---- cards ---- */
.grid-cards { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 1024px) { .grid-cards { grid-template-columns: 1fr 1fr; } }
.card {
  display: flex; gap: 12px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--raio);
  padding: 14px; box-shadow: var(--sombra-sm); transition: transform var(--rapido), box-shadow var(--rapido), border-color var(--rapido);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--sombra-md); border-color: var(--line); }
.card-corpo { flex: 1; min-width: 0; }
.card-topo { display: flex; justify-content: space-between; gap: 8px; }
.card .material { font-weight: 700; margin: 0; }
.card .medidas { margin: 2px 0 0; font-variant-numeric: tabular-nums; }
.ajuste-qtd { display: flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; height: fit-content; background: #FAFAF8; }
.ajuste-qtd button { background: none; border: none; font-size: 15px; color: var(--ink2); padding: 4px 9px; border-radius: 6px; font-weight: 700; }
.ajuste-qtd button:hover { background: var(--panel); color: var(--green); box-shadow: var(--sombra-sm); }
.ajuste-qtd span { font-weight: 700; min-width: 20px; text-align: center; }
.tag-reservado { display: inline-flex; align-items: center; margin-top: 6px; padding: 4px 9px; border-radius: 999px; background: #FBF0D6; color: #7A5502; font-size: 12px; font-weight: 600; }
.linha-meta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 7px; }
.linha-meta span { display: flex; align-items: center; }
.card .obs { font-size: 12px; font-style: italic; color: var(--ink2); margin: 6px 0 0; }
.link-historico { display: inline-flex; align-items: center; background: none; border: none; color: var(--ink2); font-size: 12px; margin-top: 9px; padding: 0; }
.link-historico:hover { color: var(--green); }
.link-historico .icone:last-child { margin: 0 0 0 4px; transition: transform var(--rapido); }
.link-historico .icone.girado { transform: rotate(180deg); }
.painel-expande { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--medio); }
.painel-expande.aberto { grid-template-rows: 1fr; }
.painel-expande > * { overflow: hidden; }
.lista-historico { margin-top: 6px; border: 1px solid var(--line-soft); border-radius: 8px; background: #FAFAF8; }
.linha-historico { display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px; border-bottom: 1px solid var(--line-soft); font-size: 12px; }
.linha-historico:last-child { border-bottom: none; }
.confirmar-exclusao { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 9px 11px; border-radius: 8px; background: #FBE9E4; border: 1px solid #EFC5B9; font-size: 12px; color: var(--red); animation: entrar-fade var(--rapido) both; }
.acoes-card { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* ---- catalogo / historico ---- */
.painel-catalogo { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--raio); overflow: hidden; box-shadow: var(--sombra-sm); }
.cabecalho-catalogo { padding: 15px; border-bottom: 1px solid var(--line-soft); background: #FAFAF8; }
.titulo-secao { font-weight: 700; margin: 0 0 4px; }
.linha-add { display: flex; gap: 8px; margin-top: 8px; }
.linha-add input, .linha-add textarea { flex: 1; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; }
.aviso-suave { background: #FBF0D6; color: #7A5502; padding: 8px 10px; border-radius: 8px; font-size: 12px; margin-top: 8px; animation: entrar-fade var(--rapido) both; }
.linha-material, .linha-log { transition: background var(--rapido); }
.linha-material { display: flex; align-items: center; gap: 10px; padding: 11px 15px; border-bottom: 1px solid var(--line-soft); }
.linha-material:hover, .linha-log:hover { background: #FAFAF8; }
.linha-material .nome { flex: 1; font-weight: 500; }
.linha-log { display: flex; justify-content: space-between; gap: 10px; padding: 11px 15px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }

/* ---- modais ---- */
.modal-overlay { position: fixed; inset: 0; background: rgba(13, 20, 18, .55); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; animation: surgir-overlay var(--rapido) both; }
.modal-box { width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; background: var(--panel); border-radius: 14px; box-shadow: var(--sombra-lg); animation: surgir-modal var(--medio) both; }
.modal-box.modal-media { max-width: 480px; }
.modal-box.modal-grande { max-width: 900px; }
.modal-cabecalho { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line-soft); }
.modal-cabecalho h2 { margin: 0; font-size: 17px; font-weight: 700; }
.modal-cabecalho button { background: none; border: none; color: var(--ink2); border-radius: 6px; padding: 4px; }
.modal-cabecalho button:hover { color: var(--ink); background: var(--line-soft); }
.modal-corpo { padding: 18px 22px; display: flex; flex-direction: column; gap: 11px; }
.modal-corpo label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink2); font-weight: 500; }
.modal-corpo input, .modal-corpo select, .modal-corpo textarea { padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; background: #FBFBFA; color: var(--ink); font-family: inherit; }
.modal-rodape { display: flex; gap: 8px; padding: 15px 22px; border-top: 1px solid var(--line-soft); background: #FAFAF8; }
.modal-rodape button { flex: 1; justify-content: center; }
.painel-suave { background: #FAFAF8; border: 1px solid var(--line-soft); border-radius: 10px; padding: 11px; animation: entrar-fade var(--rapido) both; }

.toggle-tipo { display: flex; gap: 8px; }
.opcao-tipo { flex: 1; padding: 9px; border-radius: 8px; border: 1px solid var(--line); background: #F1F2EF; color: var(--ink2); font-weight: 600; display: flex; align-items: center; justify-content: center; }
.opcao-tipo:hover { border-color: var(--green); color: var(--green); }
.opcao-tipo.ativa { background: var(--green); color: #fff; border-color: var(--green); }
.opcao-tipo.ativa:hover { color: #fff; }
.grade-campos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { background: #fff; border: 1px solid #EDD79A; border-radius: 8px; padding: 5px 9px; font-size: 12px; }
.chip:hover { border-color: var(--amber); }
.chip.ativo { background: var(--green); color: #fff; border-color: var(--green); }
.checkbox { flex-direction: row !important; align-items: center; gap: 8px !important; }

.secao-local .cabecalho-secao { display: flex; justify-content: space-between; margin-bottom: 6px; font-weight: 700; font-size: 13px; }
.grid-locais { display: grid; gap: 8px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.celula-local, .celula-vazia { height: 46px; border-radius: 8px; }
.celula-local { display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid var(--line); background: #F7F7F4; color: var(--ink); font-variant-numeric: tabular-nums; }
.celula-local:hover { border-color: var(--green); background: #EEF3F1; }
.celula-local span { font-weight: 700; }
.celula-local small { color: var(--ink2); font-size: 11px; }
.celula-local.ativa { background: var(--green); color: #fff; border-color: var(--green); }
.celula-local.ativa:hover { background: var(--green-forte); }
.celula-local.ativa small { color: #C9DAD4; }
.celula-vazia { border: 1px dashed var(--line-soft); background: #FAFAF8; }
.linha-plataforma { margin-bottom: 4px; }

.preview-linha { display: flex; align-items: center; gap: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); }

.linha-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 20px; border-bottom: 1px solid var(--line-soft); background: #FAFAF8; }
.folha-picking { padding: 16px 20px; background: #fff; max-height: 55vh; overflow-y: auto; }
.folha-cabecalho { display: flex; justify-content: space-between; padding-bottom: 10px; margin-bottom: 10px; border-bottom: 2px solid var(--ink); }
.folha-cabecalho h1 { font-size: 16px; margin: 0; }
.bloco-projeto { margin-bottom: 16px; }
.tabela-picking { width: 100%; border-collapse: collapse; font-size: 11px; }
.tabela-picking th, .tabela-picking td { border: 1px solid var(--line); padding: 5px 6px; text-align: left; }
.tabela-picking .marcar span { display: inline-block; width: 11px; height: 11px; border: 1.5px solid var(--ink); }

/* ---- impressao da lista de separacao ---- */
@media print {
  body * { visibility: hidden !important; }
  #folha-picking, #folha-picking * { visibility: visible !important; }
  #folha-picking { position: absolute; left: 0; top: 0; width: 100%; max-height: none; overflow: visible; }
  .nao-imprimir { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
