/* Sabor Majen · identidade visual
   Layout: menu vertical à esquerda (no celular abre pelo botão ☰),
   barra branca no topo e o conteúdo em cartões brancos sobre fundo creme. */
:root {
  --oliva: #6a6b2f;
  --escuro: #3a4021;
  --escuro2: #2c3118;
  --creme: #fbf4e2;
  --creme2: #f0e4ca;
  --terracota: #d07c4e;
  --manteiga: #f7d579;
  --texto: #2b2f18;
  --mut: #6b6a55;
  --erro: #a8442a;
  --fundo: #f6f1e3;
  --cartao: #ffffff;
  --linha: #ece3cc;
  --raio: 16px;
  --sombra: 0 1px 2px rgba(58, 64, 33, .05), 0 8px 24px rgba(58, 64, 33, .06);
  --lateral: 252px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }
body {
  font-family: 'Figtree', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--texto);
  background: var(--fundo);
}

h1, h2, .marca {
  font-family: 'Fraunces', Georgia, serif;
  color: var(--escuro);
  line-height: 1.2;
}
h1 { font-size: 1.75rem; margin: 0 0 14px; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 10px; }
h3 { font-family: 'Figtree', system-ui, sans-serif; font-size: 1rem; color: var(--escuro); margin: 20px 0 8px; }
h2.sub { margin-top: 30px; }

.mut { color: var(--mut); }
.erro { color: var(--erro); font-weight: 600; min-height: 1.2em; margin: 4px 0; white-space: pre-line; }
.erro:empty { min-height: 0; margin: 0; }
.ok { color: var(--oliva); font-weight: 600; margin: 4px 0; }
.ok:empty { display: none; }

/* ---------- login ---------- */
.centro {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
}
#tela-login {
  background:
    radial-gradient(circle at 15% 20%, rgba(247, 213, 121, .18), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(208, 124, 78, .22), transparent 45%),
    linear-gradient(135deg, var(--escuro2), var(--oliva));
}
.cartao {
  width: 100%;
  max-width: 400px;
  background: var(--cartao);
  border-radius: 22px;
  padding: 32px 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.cartao h1 { text-align: center; }
.logo {
  display: block;
  width: 150px;
  max-width: 60%;
  height: auto;
  margin: 0 auto 18px;
  border-radius: 14px;
}

form { display: grid; gap: 12px; }
label { display: grid; gap: 5px; font-weight: 600; font-size: .92rem; }
input, select, textarea {
  font: inherit;
  font-weight: 400;
  padding: 11px 12px;
  border: 1px solid #ddd2b6;
  border-radius: 10px;
  background: #fff;
  color: var(--texto);
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--oliva); box-shadow: 0 0 0 3px rgba(247, 213, 121, .7); }
select, textarea { font: inherit; font-weight: 400; }
textarea { resize: vertical; }
label small { font-weight: 400; font-size: .82rem; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: auto; accent-color: var(--oliva); }
.grade { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ---------- botões ---------- */
.btn {
  font: inherit;
  font-weight: 700;
  padding: 11px 18px;
  border: 0;
  border-radius: 10px;
  background: var(--oliva);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(106, 107, 47, .25);
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--escuro); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.sec { background: #fff; color: var(--escuro); border: 1px solid #ddd2b6; box-shadow: none; }
.btn.sec:hover { background: var(--creme); border-color: var(--oliva); }
.btn.perigo { background: var(--erro); box-shadow: none; }
.btn.perigo:hover { background: #7f321e; }
.btn.peq { padding: 6px 12px; font-size: .88rem; border-radius: 8px; }
.btn.claro { background: transparent; color: var(--creme); border: 1px solid rgba(255, 255, 255, .3); box-shadow: none; padding: 8px 14px; }

.link {
  font: inherit;
  background: none;
  border: 0;
  color: var(--oliva);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 4px;
  justify-self: center;
}
.link.voltar { justify-self: start; padding: 0; margin-bottom: 8px; text-decoration: none; }
.link.voltar:hover { text-decoration: underline; }

/* ---------- estrutura: menu lateral + área principal ---------- */
.app {
  display: grid;
  grid-template-columns: var(--lateral) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}
.lateral {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--escuro) 0%, var(--escuro2) 100%);
  color: var(--creme);
  overflow-y: auto;
  z-index: 30;
}
.lateral-marca {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.lateral-logo { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; background: var(--creme); }
.lateral-marca span { display: grid; line-height: 1.15; }
.lateral-marca b { font-family: 'Fraunces', Georgia, serif; font-size: 1.15rem; color: #fff; }
.lateral-marca small { color: var(--manteiga); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }

.menu { display: grid; gap: 2px; padding: 8px 12px 16px; }
.menu-grupo {
  margin: 14px 10px 4px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(251, 244, 226, .45);
}
.menu button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  font: inherit;
  font-size: .95rem;
  font-weight: 500;
  text-align: left;
  background: transparent;
  color: rgba(251, 244, 226, .82);
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
@media (max-height: 820px) and (min-width: 901px) {
  .menu button { padding: 6px 12px; }
  .menu-grupo { margin-top: 10px; }
}
.menu button:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.menu button.ativa {
  background: var(--manteiga);
  color: var(--escuro2);
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
}
.menu svg, .btn-sair svg, .btn-menu svg {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lateral-rodape {
  margin-top: auto;
  padding: 14px 16px 18px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  display: grid;
  gap: 8px;
}
.usuario { color: rgba(251, 244, 226, .65); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-sair {
  display: flex;
  align-items: center;
  gap: 10px;
  font: inherit;
  font-weight: 600;
  background: rgba(255, 255, 255, .06);
  color: var(--creme);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}
.btn-sair:hover { background: rgba(208, 124, 78, .35); }

.principal { min-width: 0; display: flex; flex-direction: column; }
.topo {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 28px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--linha);
}
.topo-titulo { display: grid; line-height: 1.2; min-width: 0; }
.topo-titulo small { color: var(--mut); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.topo-titulo b { color: var(--escuro); font-size: 1.02rem; }
.topo-data { margin-left: auto; color: var(--mut); font-size: .88rem; white-space: nowrap; }
.topo-data::first-letter { text-transform: uppercase; }
.btn-menu {
  display: none;
  background: var(--creme);
  color: var(--escuro);
  border: 1px solid var(--linha);
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
}
.fundo-menu { position: fixed; inset: 0; background: rgba(28, 31, 15, .5); z-index: 25; }

.conteudo { width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 28px 48px; }

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .lateral {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 272px;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 8px 0 30px rgba(0, 0, 0, .25);
    z-index: 50;
  }
  .fundo-menu { z-index: 45; }
  body.menu-aberto .lateral { transform: none; }
  .btn-menu { display: inline-flex; }
  .topo { padding: 10px 16px; }
  .conteudo { padding: 20px 16px 40px; }
}
@media (max-width: 520px) { .topo-data { display: none; } }

/* ---------- cartões (seções) ---------- */
.painel {
  background: var(--cartao);
  border: 1px solid var(--linha);
  border-radius: var(--raio);
  box-shadow: var(--sombra);
  padding: 20px 22px;
  margin: 18px 0;
}
.painel.alerta { border-color: #efc9b0; box-shadow: inset 4px 0 0 var(--terracota), var(--sombra); background: #fffaf6; }
.painel code {
  background: var(--creme);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: .95em;
}

/* ---------- abas dentro de uma tela ---------- */
.abas {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 4px;
  margin-bottom: 18px;
  background: #fff;
  border: 1px solid var(--linha);
  border-radius: 12px;
  width: fit-content;
  max-width: 100%;
}
.aba {
  font: inherit;
  font-size: .92rem;
  font-weight: 600;
  background: transparent;
  border: 0;
  border-radius: 9px;
  padding: 7px 14px;
  cursor: pointer;
  color: var(--mut);
  white-space: nowrap;
}
.aba:hover { color: var(--escuro); background: var(--creme); }
.aba.ativa { background: var(--escuro); color: var(--creme); }

.barra { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 14px 0 18px; }
.barra select { width: auto; padding: 9px 10px; }
.barra input[type=search] { width: auto; flex: 1 1 200px; }

/* ---------- listas ---------- */
.lista { display: grid; gap: 10px; }
.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--cartao);
  border: 1px solid var(--linha);
  border-radius: 12px;
  padding: 13px 16px;
  box-shadow: 0 1px 2px rgba(58, 64, 33, .04);
  transition: border-color .15s, box-shadow .15s;
}
.item:hover { border-color: #d9cca8; box-shadow: var(--sombra); }
.item.inativo { opacity: .6; }
.item.marcado { box-shadow: inset 4px 0 0 var(--terracota); }
.item-texto { display: grid; gap: 2px; min-width: 0; }
.item-texto .mut { font-size: .9rem; }
.acoes { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
@media (max-width: 560px) {
  .item { flex-direction: column; align-items: stretch; }
  .acoes { justify-content: flex-start; }
}

.selo {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--creme2);
  color: var(--mut);
  vertical-align: middle;
}
.selo.neutro { background: #e6e7c9; color: var(--escuro); }
.selo.alerta { background: #fbe7b0; color: #7a5a10; }
.selo.amostra { background: #f6dccb; color: #8a4422; }

.vazio { color: var(--mut); background: var(--cartao); border: 1px dashed #d9cca8; border-radius: 12px; padding: 18px; text-align: center; }
.calculo { background: var(--creme); border: 1px solid var(--linha); border-radius: 10px; padding: 9px 12px; margin: 8px 0; }
.calculo:empty { display: none; }
.peq { font-size: .85rem; }
.txt-grave { color: var(--erro); font-weight: 600; }
.titulo-linha { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.titulo-linha h2 { margin: 0; }
form.adicionar { background: var(--cartao); border: 1px solid var(--linha); border-radius: 12px; padding: 6px 16px 16px; margin-top: 16px; }
.passos { margin: 0; padding-left: 20px; display: grid; gap: 6px; }

/* ---------- números em destaque (cartões de indicadores) ---------- */
.alertas { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.alertas li.grave { color: var(--erro); }
.numeros { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin: 18px 0; }
.numeros > div {
  position: relative;
  display: grid;
  gap: 3px;
  background: var(--cartao);
  border: 1px solid var(--linha);
  border-radius: 14px;
  padding: 16px 18px 14px;
  box-shadow: var(--sombra);
  overflow: hidden;
}
.numeros > div::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--oliva);
}
.numeros > div:nth-child(4n+2)::before { background: var(--terracota); }
.numeros > div:nth-child(4n+3)::before { background: var(--manteiga); }
.numeros > div:nth-child(4n+4)::before { background: var(--escuro); }
.numeros > div > .mut:first-child { font-size: .85rem; font-weight: 600; }
.numeros b { font-family: 'Fraunces', Georgia, serif; font-size: 1.65rem; color: var(--escuro); line-height: 1.15; }
.numeros small { font-size: .8rem; }
.painel .numeros { margin: 12px 0; }
.painel .numeros > div { box-shadow: none; background: var(--fundo); }

details.dobra { display: block; }
details.dobra summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; list-style: none; }
details.dobra summary::-webkit-details-marker { display: none; }
details.dobra summary::after { content: '▾'; color: var(--mut); }
details.dobra[open] summary::after { content: '▴'; }
.saldo { font-weight: 700; color: var(--escuro); white-space: nowrap; margin-left: auto; }
.sublista { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.sublista li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--linha); padding-top: 8px; }

/* ---------- janelas (diálogos) ---------- */
.dialogo {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  border: 0;
  border-radius: 18px;
  padding: 24px;
  background: var(--cartao);
  color: var(--texto);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .3);
}
.dialogo.largo { width: min(900px, calc(100vw - 24px)); }
.dialogo::backdrop { background: rgba(28, 31, 15, .55); backdrop-filter: blur(2px); }
.dialogo .botoes { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.acoes-extra { display: flex; gap: 8px; border-top: 1px solid var(--linha); padding-top: 12px; }

/* ---------- aviso rápido ---------- */
.aviso {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--escuro);
  color: var(--creme);
  padding: 11px 20px;
  border-radius: 999px;
  font-weight: 600;
  z-index: 100;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}

/* ---------- faixa do ambiente de teste ---------- */
.faixa-teste {
  position: relative;
  z-index: 40;
  background: repeating-linear-gradient(-45deg, var(--manteiga), var(--manteiga) 14px, #f2c94c 14px, #f2c94c 28px);
  color: var(--escuro);
  font-weight: 700;
  text-align: center;
  padding: 6px 12px;
  font-size: .9rem;
}

/* ---------- produção ---------- */
.form-producao { gap: 4px; }
.form-producao .painel { margin: 10px 0; display: grid; gap: 10px; }
.form-producao .painel h2 { margin: 0; }
.linha-ing { border-top: 1px solid var(--linha); padding-top: 10px; display: grid; gap: 6px; }
.linha-ing-nome small { font-weight: 400; }
.grade-3 { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.botoes-fim { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.previa { box-shadow: inset 4px 0 0 var(--manteiga), var(--sombra); }
.previa .carregando, [data-previa].carregando { opacity: .55; transition: opacity .2s; }
.formula { font-size: .85rem; color: var(--mut); background: var(--creme); border: 1px solid var(--linha); border-radius: 10px; padding: 8px 12px; margin: 8px 0 12px; }

/* ---------- tabelas ---------- */
.rolar { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--linha); border-radius: 12px; }
.tabela { width: 100%; border-collapse: collapse; font-size: .92rem; background: var(--cartao); }
.tabela th, .tabela td { padding: 9px 12px; border-bottom: 1px solid var(--linha); text-align: left; vertical-align: top; }
.tabela tr:last-child > * { border-bottom: 0; }
.tabela th { font-size: .78rem; color: var(--mut); font-weight: 700; white-space: nowrap; background: var(--creme); letter-spacing: .02em; }
.tabela tr:hover td { background: #fffcf3; }
.tabela .n { text-align: right; white-space: nowrap; }

/* ---------- painel e histórico ---------- */
.linha-campo { display: flex; align-items: center; gap: 8px; }
.linha-campo input { width: auto; }

/* ---------- manual ---------- */
.manual section { scroll-margin-top: 80px; }
.manual-indice ol { margin: 0; padding-left: 22px; columns: 2 240px; column-gap: 32px; }
.manual-indice li { margin: 3px 0; break-inside: avoid; }
.manual-indice a { color: var(--oliva); font-weight: 600; text-decoration: none; }
.manual-indice a:hover { text-decoration: underline; }
.manual .passos li { line-height: 1.55; }

/* Impressão / "Salvar como PDF": só o conteúdo, sem menu nem barra. */
@media print {
  @page { margin: 16mm 14mm; }
  body { background: #fff; font-size: 11pt; }
  .lateral, .topo, .faixa-teste, .fundo-menu, .sem-impressao, .aviso { display: none !important; }
  .app { display: block; }
  .conteudo { max-width: none; padding: 0; }
  .painel { box-shadow: none; border: 1px solid #ddd; break-inside: auto; margin: 0 0 12px; }
  .painel h2 { break-after: avoid; }
  .tabela tr, .passos li, .formula { break-inside: avoid; }
  .rolar { overflow: visible; }
  .manual-indice a { color: var(--texto); }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Sugestões de cliente (Pedidos): lista de botões abaixo do campo de busca */
.sugestoes { display: grid; gap: 4px; }
.sugestoes:empty { display: none; }
.sugestoes .btn { text-align: left; justify-content: flex-start; font-weight: 400; }
