:root {
  --azul: #0b3d91; --azul-2: #1252b8; --vermelho: #d7141b; --amarelo: #f7c300;
  --fundo: #f4f5f8; --superficie: #ffffff; --texto: #1c2233; --sutil: #6a7286; --borda: #e2e5ec;
  --ok: #138a4b; --alerta: #b7791f; --raio: 10px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--texto); background: var(--fundo);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--fundo); }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
.sutil { color: var(--sutil); }
.erro { color: var(--vermelho); min-height: 1.2em; margin: 0; font-size: .9rem; }

.btn { border: 1px solid var(--borda); background: var(--superficie); color: var(--texto); border-radius: 8px; padding: .55rem .9rem;
  font: inherit; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s; }
.btn:hover { border-color: #c9ceda; }
.btn.primario { background: var(--azul); border-color: var(--azul); color: #fff; }
.btn.primario:hover { background: var(--azul-2); }
.btn.perigo { color: var(--vermelho); }
.btn.fantasma { background: transparent; border-color: transparent; }
.btn:disabled { opacity: .55; cursor: wait; }
input, select { font: inherit; border: 1px solid var(--borda); border-radius: 8px; padding: .55rem .7rem; background: #fff; color: var(--texto); width: 100%; }
input:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--azul) 35%, transparent); border-color: var(--azul); }
label { display: grid; gap: .3rem; font-size: .85rem; font-weight: 600; color: var(--sutil); }

/* Acesso */
.acesso { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 500px at 50% -10%, #dfe8fb, var(--fundo)); }
.cartao-acesso { width: min(380px, 100%); background: var(--superficie); border-radius: 16px; padding: 28px; display: grid; gap: 14px;
  box-shadow: 0 10px 40px rgba(16, 32, 80, .12); }
.logo-acesso { width: 72px; justify-self: center; }
.cartao-acesso h1 { text-align: center; font-size: 1.35rem; }
.cartao-acesso .sutil { text-align: center; margin: -8px 0 4px; }

/* Layout */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.lateral { background: #0d1b3d; color: #dfe6f5; padding: 20px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.marca { display: flex; gap: 10px; align-items: center; padding: 0 6px; }
.marca img { width: 40px; height: 40px; }
.marca strong { display: block; color: #fff; }
.marca span { font-size: .8rem; color: #9fb0d4; }
.lateral nav { display: grid; gap: 4px; }
.lateral nav a { color: #c9d4ee; text-decoration: none; padding: .6rem .75rem; border-radius: 8px; font-weight: 600; }
.lateral nav a:hover { background: rgba(255,255,255,.06); }
.lateral nav a.ativo { background: rgba(255,255,255,.12); color: #fff; }
.sair { margin-top: auto; color: #9fb0d4; }
main { padding: 28px clamp(16px, 3vw, 40px); min-width: 0; }
.topo { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.topo h1 { font-size: 1.5rem; }
.filtros { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.filtros input { max-width: 340px; }
.filtros select { max-width: 200px; }

/* Produtos */
.grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.prod { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); overflow: hidden; display: flex; flex-direction: column; cursor: pointer; transition: box-shadow .15s, transform .15s; }
.prod:hover { box-shadow: 0 6px 20px rgba(16,32,80,.08); transform: translateY(-1px); }
.prod .foto { height: 160px; background: repeating-conic-gradient(#f2f3f6 0 25%, #fff 0 50%) 0 0 / 16px 16px; display: grid; place-items: center; padding: 10px; }
.prod .foto img { max-width: 100%; max-height: 140px; object-fit: contain; }
.prod .foto .vazia { color: var(--alerta); font-size: .8rem; font-weight: 700; }
.prod .info { padding: 10px 12px 12px; display: grid; gap: 4px; }
.prod .nome { font-weight: 650; font-size: .92rem; line-height: 1.25; }
.prod .meta { display: flex; justify-content: space-between; align-items: center; font-size: .8rem; color: var(--sutil); }
.etiqueta { font-size: .72rem; font-weight: 700; padding: .15rem .45rem; border-radius: 999px; background: #eef2fb; color: var(--azul); text-transform: uppercase; letter-spacing: .03em; }
.etiqueta.acougue { background: #fdecec; color: var(--vermelho); }
.etiqueta.padaria { background: #fff6dc; color: #8a6400; }
.etiqueta.hortifruti { background: #e7f6ec; color: var(--ok); }
.preco { font-weight: 800; color: var(--vermelho); }

/* Campanhas */
.lista { display: grid; gap: 10px; }
.linha { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); padding: 14px 16px; display: grid; grid-template-columns: 1fr auto auto; gap: 16px; align-items: center; cursor: pointer; }
.linha:hover { border-color: #c9ceda; }
.linha h3 { font-size: 1rem; }
.status { font-size: .75rem; font-weight: 700; padding: .25rem .55rem; border-radius: 999px; background: #eef0f4; color: var(--sutil); white-space: nowrap; }
.status.em_conferencia, .status.em_aprovacao { background: #fff6dc; color: #8a6400; }
.status.aprovada, .status.publicada { background: #e7f6ec; color: var(--ok); }
.progresso { font-variant-numeric: tabular-nums; color: var(--sutil); font-size: .9rem; }
.secao-bloco { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); margin-bottom: 16px; }
.secao-bloco header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--borda); }
.secao-bloco header h3 { font-size: 1rem; }
.itens { display: grid; }
.item { display: grid; grid-template-columns: 28px 52px 1fr 120px 36px; gap: 12px; align-items: center; padding: 8px 16px; border-bottom: 1px solid var(--borda); }
.item:last-child { border-bottom: 0; }
.item .pos { color: var(--sutil); font-variant-numeric: tabular-nums; text-align: right; }
.item img { width: 52px; height: 40px; object-fit: contain; }
.item input { padding: .4rem .5rem; text-align: right; font-weight: 700; color: var(--vermelho); }
.adicionar { display: grid; grid-template-columns: 1fr 120px auto; gap: 8px; padding: 12px 16px; background: #fafbfd; border-top: 1px solid var(--borda); border-radius: 0 0 var(--raio) var(--raio); }
.sugestoes { position: relative; }
.sugestoes ul { position: absolute; z-index: 5; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 4px; list-style: none; background: #fff; border: 1px solid var(--borda); border-radius: 8px; box-shadow: 0 10px 30px rgba(16,32,80,.12); max-height: 260px; overflow: auto; }
.sugestoes li { padding: .45rem .6rem; border-radius: 6px; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.sugestoes li:hover, .sugestoes li.sel { background: #eef2fb; }
.sugestoes li img { width: 32px; height: 24px; object-fit: contain; }
.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.galeria a { display: block; background: var(--superficie); border: 1px solid var(--borda); border-radius: 8px; padding: 6px; text-decoration: none; color: var(--sutil); font-size: .78rem; }
.galeria img { width: 100%; height: 150px; object-fit: contain; display: block; margin-bottom: 4px; }
.avisos { background: #fff6dc; color: #6b4e00; border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-size: .9rem; }

/* Diálogo */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(16,32,80,.25); }
dialog::backdrop { background: rgba(13, 27, 61, .45); }
#dlg-form { padding: 22px; display: grid; gap: 14px; }
.duas { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.acoes { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; }
.acoes .dir { display: flex; gap: 8px; margin-left: auto; }
.preview-foto { height: 160px; border-radius: 8px; background: repeating-conic-gradient(#f2f3f6 0 25%, #fff 0 50%) 0 0 / 16px 16px; display: grid; place-items: center; }
.preview-foto img { max-height: 150px; max-width: 100%; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #0d1b3d; color: #fff; padding: .7rem 1rem; border-radius: 10px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.2); z-index: 50; }
.vazio { text-align: center; padding: 48px 16px; color: var(--sutil); background: var(--superficie); border: 1px dashed var(--borda); border-radius: var(--raio); }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .lateral { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 10px; }
  .lateral nav { display: flex; flex-wrap: wrap; }
  .sair { margin: 0 0 0 auto; }
  .item { grid-template-columns: 22px 44px 1fr 92px 30px; gap: 8px; padding: 8px 10px; }
  .adicionar { grid-template-columns: 1fr; }
  .linha { grid-template-columns: 1fr; gap: 6px; }
  .duas { grid-template-columns: 1fr; }
}
