:root {
  --bg: #f4f5f7; --card: #ffffff; --ink: #1c1f24; --ink2: #555b66; --muted: #8a909a;
  --line: #dfe2e7; --brand: #1f5fae; --brand-ink: #ffffff; --brand-soft: #e8f0fa;
  --perda: #b3261e; --perda-soft: #fdecea; --sobra: #1b6e3a; --sobra-soft: #e6f4ea;
  --aviso: #8a5a00; --aviso-soft: #fff4d6; --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); }
h1 { font-size: 1.35rem; margin: 0 0 14px; }
h2 { font-size: 1.1rem; margin: 0 0 10px; }

/* topo */
.topo { background: var(--brand); color: var(--brand-ink); }
.topo-in { max-width: 980px; margin: 0 auto; padding: 10px 16px; display: flex;
  align-items: center; gap: 12px; }
.marca { white-space: nowrap; font-weight: 700; font-size: 1.05rem; color: #fff; text-decoration: none; margin-right: auto; }
.perfil { font-size: .8rem; opacity: .85; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topo .btn { flex: 0 0 auto; }
nav.menu { background: #fff; border-bottom: 1px solid var(--line); overflow-x: auto; }
nav.menu .in { max-width: 980px; margin: 0 auto; display: flex; gap: 4px; padding: 0 10px; }
nav.menu a { padding: 12px 10px; text-decoration: none; color: var(--ink2); white-space: nowrap;
  border-bottom: 3px solid transparent; font-weight: 500; }
nav.menu a.ativo { color: var(--brand); border-bottom-color: var(--brand); }

main { max-width: 980px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px; }

/* formulários */
label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 5px; }
.campo { margin-bottom: 14px; }
input[type=text], input[type=password], input[type=date], select, textarea {
  width: 100%; font: inherit; font-size: 16px; padding: 11px 12px; border: 1px solid #c8cdd4;
  border-radius: 8px; background: #fff; color: var(--ink); }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
input[readonly] { background: #f0f2f5; color: var(--ink); }
textarea:disabled { background: #eceef1; color: var(--muted); cursor: not-allowed; }
.linha2 { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 640px) {
  .linha2 { grid-template-columns: 1fr 1fr; }
  .linha-cod { grid-template-columns: 180px 1fr; }
  .linha3 { grid-template-columns: 1fr 1fr 1fr; }
  .linha4 { grid-template-columns: 140px 2fr 1fr 1fr; }
}
.ajuda { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.ajuda.erro { color: var(--perda); font-weight: 600; }
.ajuda.ok { color: var(--sobra); }

.checks { display: flex; gap: 10px; flex-wrap: wrap; }
.checks label { display: flex; align-items: center; gap: 8px; font-weight: 500; border: 1px solid #c8cdd4;
  border-radius: 8px; padding: 10px 14px; background: #fff; cursor: pointer; margin: 0; }
.checks input { width: 20px; height: 20px; margin: 0; accent-color: var(--brand); }
.checks label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.obrig { color: var(--perda); }

.diferenca { border-radius: 8px; padding: 11px 12px; font-weight: 700; border: 1px solid var(--line);
  background: #f0f2f5; min-height: 46px; }
.diferenca.perda { background: var(--perda-soft); color: var(--perda); border-color: #f3c5c1; }
.diferenca.sobra { background: var(--sobra-soft); color: var(--sobra); border-color: #bfe0c9; }

.btn { display: inline-block; font: inherit; font-weight: 600; border: 0; border-radius: 8px;
  padding: 12px 18px; background: var(--brand); color: #fff; cursor: pointer; text-decoration: none; text-align: center; }
.btn.sec { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn.peq { padding: 8px 12px; font-size: .9rem; }
.btn.perigo { background: #fff; color: var(--perda); border: 1px solid #e6b3ae; }
.btn.largo { width: 100%; }

.msg { border-radius: 8px; padding: 11px 14px; margin-bottom: 12px; }
.msg.erro { background: var(--perda-soft); color: var(--perda); }
.msg.ok { background: var(--sobra-soft); color: var(--sobra); }
.msg ul { margin: 0; padding-left: 18px; }

/* listas */
.filtros { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.filtros .campo { margin: 0; }
.filtros .acoes { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
@media (min-width: 760px) { .filtros { grid-template-columns: repeat(4, 1fr); } }
.resumo { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; flex: 1 1 140px; }
.kpi .v { font-size: 1.35rem; font-weight: 700; }
.kpi .r { font-size: .8rem; color: var(--ink2); }

.itens { list-style: none; margin: 0; padding: 0; }
.itens li a { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 8px; color: var(--ink); text-decoration: none; }
.itens li a:hover { border-color: var(--brand); }
.it-top { display: flex; justify-content: space-between; gap: 8px; font-size: .82rem; color: var(--ink2); }
.it-nome { font-weight: 600; margin: 3px 0; }
.it-base { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .9rem; }

.tag { display: inline-block; font-size: .75rem; font-weight: 600; border-radius: 99px; padding: 2px 9px; background: #eceef1; color: var(--ink2); }
.tag.aguardando_expedicao, .tag.aguardando_vendas, .tag.aguardando_escritorio { background: var(--aviso-soft); color: var(--aviso); }
.tag.finalizada { background: var(--sobra-soft); color: var(--sobra); }
.v-perda { color: var(--perda); font-weight: 700; }
.v-sobra { color: var(--sobra); font-weight: 700; }

/* detalhe */
dl.dados { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin: 0; }
dl.dados div.inteiro { grid-column: 1 / -1; }
dl.dados dt { font-size: .78rem; color: var(--ink2); }
dl.dados dd { margin: 0; font-weight: 600; }
dl.dados dd.texto { white-space: pre-wrap; }
.etapa { border-left: 4px solid var(--line); padding: 8px 12px; margin-bottom: 10px; }
.etapa.feita { border-color: var(--sobra); }
.etapa.atual { border-color: #e0a100; background: var(--aviso-soft); }
.etapa .t { font-weight: 700; }
.etapa .q { font-size: .82rem; color: var(--ink2); }
.etapa p { margin: 6px 0 0; white-space: pre-wrap; }
.aviso-status { background: var(--aviso-soft); color: var(--aviso); border-radius: 8px; padding: 10px 14px; font-weight: 600; margin-bottom: 12px; }
.aviso-status.fim { background: var(--sobra-soft); color: var(--sobra); }

/* gráficos */
.graf-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 820px) { .graf-grid { grid-template-columns: 1fr 1fr; } .graf-grid .largo { grid-column: 1 / -1; } }
.graf { position: relative; height: 260px; }
table.tab { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.tab th, table.tab td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: right; }
table.tab th:first-child, table.tab td:first-child { text-align: left; }
table.tab th { color: var(--ink2); font-weight: 600; }

.sugestoes { list-style: none; margin: 4px 0 0; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; max-height: 260px; overflow-y: auto; }
.sugestoes li { padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: .92rem; }
.sugestoes li:hover { background: var(--brand-soft); }
.sugestoes b { color: var(--brand); }

.login-box { max-width: 380px; margin: 40px auto; }
.pag { display: flex; gap: 8px; justify-content: center; align-items: center; margin: 14px 0; }
.admin-nomes li { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.admin-nomes { list-style: none; padding: 0; margin: 0 0 10px; }
.inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.inline > * { flex: 1 1 160px; }
.inline .btn { flex: 0 0 auto; }

/* rodapé e ambiente de teste */
.rodape { text-align: center; font-size: .78rem; color: var(--muted); padding: 10px 16px 24px; }
.faixa-teste { background: #b3261e; color: #fff; text-align: center; font-weight: 700; font-size: .85rem;
  padding: 6px 12px; letter-spacing: .02em; }
.ambiente-teste .topo { background: #8a3a00; }
.ambiente-teste nav.menu a.ativo { color: #8a3a00; border-bottom-color: #8a3a00; }

/* "hidden" sempre esconde, mesmo em elementos com display próprio (ex.: .badge) */
[hidden] { display: none !important; }

/* aviso de pendentes no menu */
.badge { display: inline-block; min-width: 20px; margin-left: 6px; padding: 1px 6px; border-radius: 99px;
  background: var(--perda); color: #fff; font-size: .75rem; font-weight: 700; text-align: center; }

/* gráficos pequenos da tela inicial */
.graf.mini { height: 150px; margin-top: 8px; }
.v-mini { font-size: 1.35rem; font-weight: 700; }
.r-mini { font-size: .82rem; color: var(--ink2); }
.graf-grid + .ajuda { margin-top: -4px; }
.acoes-admin { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.acoes-admin form { margin: 0; }

/* histórico de edições da ficha */
.edicao { margin-bottom: 14px; }
.edicao:last-child { margin-bottom: 0; }
.edicao .q, .card > .q { font-size: .88rem; color: var(--ink2); margin-bottom: 6px; }
table.tab-edicao th, table.tab-edicao td { text-align: left; vertical-align: top; white-space: pre-wrap; }
table.tab-edicao td:first-child { font-weight: 600; width: 26%; }
table.tab-edicao td.antes { color: var(--perda); background: var(--perda-soft); }
table.tab-edicao td.depois { color: var(--sobra); background: var(--sobra-soft); }

/* ---------------------------------------------------------------------------
   Remarcação de pisos
   --------------------------------------------------------------------------- */
main.largo { max-width: 1400px; }
.etq { display: inline-block; font-size: .75rem; font-weight: 700; border-radius: 99px; padding: 2px 10px;
  border: 1px solid transparent; white-space: nowrap; }
.etq.Amarela  { background: #fff4c2; color: #6b5200; border-color: #ecd77a; }
.etq.Verde    { background: #e3f4e8; color: #1b6e3a; border-color: #a9d8b8; }
.etq.Laranja  { background: #ffe8d1; color: #9a4a00; border-color: #f3bd88; }
.etq.Vermelha { background: #fde2df; color: #a4221a; border-color: #eea9a2; }
.kpi.link { text-decoration: none; color: inherit; }
.kpi.link:hover { border-color: var(--brand); }
.kpi.sel { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.kpi .barra { height: 4px; border-radius: 2px; margin-top: 6px; }
.barra.Amarela { background: #e6c94a; } .barra.Verde { background: #3aa162; }
.barra.Laranja { background: #ef8b2c; } .barra.Vermelha { background: #d0453b; }

.tab-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table.rem { width: 100%; border-collapse: collapse; font-size: .86rem; }
table.rem th, table.rem td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
table.rem th { position: sticky; top: 0; background: #f7f8fa; color: var(--ink2); font-weight: 600; font-size: .78rem; z-index: 1; }
table.rem td.t, table.rem th.t { text-align: left; }
table.rem td.prod { white-space: normal; min-width: 240px; max-width: 360px; }
table.rem td.prod a { color: var(--ink); text-decoration: none; font-weight: 600; }
table.rem td.prod a:hover { color: var(--brand); text-decoration: underline; }
table.rem td.prod .sub { font-size: .75rem; color: var(--muted); font-weight: 400; }
table.rem tr:hover td { background: #fafbfc; }
table.rem td.c, table.rem th.c { text-align: center; }
table.rem td.pts b { font-size: 1rem; }
table.rem td.pts span { color: var(--muted); font-size: .72rem; display: block; }
table.rem .preco { font-weight: 700; }
table.rem input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; }
table.rem td.marc label { display: inline-flex; flex-direction: column; align-items: center; font-size: .66rem;
  color: var(--ink2); font-weight: 500; margin: 0 2px; cursor: pointer; }
.alerta { font-size: .75rem; font-weight: 600; white-space: normal; min-width: 120px; display: inline-block; text-align: left; }
.alerta.grave { color: var(--perda); } .alerta.medio { color: var(--aviso); } .alerta.info { color: var(--ink2); font-weight: 500; }
.ficha-flag { display: inline-block; font-size: .68rem; font-weight: 700; color: var(--aviso); background: var(--aviso-soft);
  border-radius: 4px; padding: 0 5px; margin-left: 4px; text-decoration: none; }
.impressa { font-size: .72rem; color: var(--sobra); }
.salvando td { opacity: .55; }
.barra-acoes { position: sticky; bottom: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 14px; margin-top: 10px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  box-shadow: 0 -4px 14px rgba(0,0,0,.06); }
.barra-acoes .qtd { font-weight: 600; margin-right: auto; }
.topo-analise { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.topo-analise h1 { margin: 0; }
.topo-analise .sub { color: var(--ink2); font-size: .88rem; }
.filtros.rem { grid-template-columns: 1fr 1fr; }
@media (min-width: 760px) { .filtros.rem { grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1fr; } }
.selo { display: inline-block; font-size: .68rem; font-weight: 800; letter-spacing: .03em; color: var(--brand);
  border: 1px solid var(--brand); border-radius: 4px; padding: 0 5px; margin-left: 4px; white-space: nowrap; }
.manual { color: var(--brand); font-size: .8em; margin-left: 2px; cursor: help; }
.contado { font-size: .66rem; color: var(--sobra); font-weight: 600; cursor: help; }
.preco-manual { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; align-items: end; }

/* detalhe */
.pontos-lista { list-style: none; padding: 0; margin: 0; }
.pontos-lista li { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); }
.pontos-lista li b { color: var(--brand); }
.pontos-lista li.total { border-bottom: 0; font-weight: 700; font-size: 1.05rem; }
.precos { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.precos .kpi .v { font-size: 1.25rem; }
.marcas-form { display: flex; gap: 10px; flex-wrap: wrap; }
.marcas-form form { margin: 0; }
.btn.on { background: var(--brand); color: #fff; }

/* consulta de preço */
.consulta-card { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; align-items: center; }
.consulta-card .preco-grande { font-size: 1.8rem; font-weight: 800; color: var(--ink); text-align: right; line-height: 1.1; }
.consulta-card .de { text-decoration: line-through; color: var(--muted); font-size: .9rem; text-align: right; }
.consulta-card .lote { font-size: .9rem; color: var(--ink2); text-align: right; }
.calc { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; align-items: end; }
.alerta { min-width: 0; white-space: nowrap; }
span.un { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
span.un input { width: 100px; }
table.rem th, table.rem td { padding: 7px 6px; }
table.rem td.prod { min-width: 190px; max-width: 280px; }

/* ---------------------------------------------------------------------------
   Fotos (piso e avaria) e visualizador em tela cheia
   --------------------------------------------------------------------------- */
a.foto-link { display: inline-block; line-height: 0; flex: 0 0 auto; }
.foto-mini { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; display: block; background: #eceef1; }
.com-foto { display: flex; gap: 12px; align-items: center; }
.com-foto > :not(a) { flex: 1 1 auto; min-width: 0; }
.fotos-grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px;
  max-width: 440px; margin-bottom: 10px; }
.fotos-grade:empty { display: none; }
.foto-item { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #eceef1;
  display: flex; align-items: center; justify-content: center; }
.foto-item img, .foto-item a.foto-link { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto-x { position: absolute; top: 4px; right: 4px; width: 34px; height: 34px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.62); color: #fff; font-size: 1rem; line-height: 1; cursor: pointer; padding: 0; }
.foto-x form { margin: 0; }
.foto-carregando { font-size: .8rem; color: var(--ink2); }
.foto-info { font-size: .75rem; color: var(--muted); line-height: 1.3; margin-top: 3px; }
.foto-remover-lbl { display: flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 500; margin-top: 4px; }
.foto-remover-lbl input { width: 18px; height: 18px; accent-color: var(--perda); margin: 0; }
.btn-foto { font-size: 1.05rem; padding: 15px 22px; min-height: 54px; }
.tem-foto { white-space: nowrap; }
.visualizador { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.92); display: flex;
  align-items: center; justify-content: center; padding: 12px; touch-action: pinch-zoom; }
.visualizador img { max-width: 100%; max-height: 100%; object-fit: contain; }
.vis-fechar { position: absolute; top: 10px; right: 10px; width: 48px; height: 48px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.18); color: #fff; font-size: 1.4rem; cursor: pointer; }
/* consulta de preço: foto em cima no celular, à esquerda no computador */
.consulta-foto { display: grid; grid-template-columns: 1fr; gap: 12px; }
.consulta-foto > a.foto-link { display: block; }
.consulta-foto > a.foto-link img { width: 100%; height: 220px; max-height: 220px; object-fit: cover; border-radius: 8px; display: block; }
@media (min-width: 640px) {
  .consulta-foto { grid-template-columns: 170px 1fr; align-items: center; }
  .consulta-foto > a.foto-link img { height: 170px; }
}

/* ---- Pré-cadastro (v1.8.0) ---- */
.checks.escolha label { padding: 9px 12px; }
.checks.escolha .desc { font-weight: 400; font-size: .78rem; color: var(--ink2); }
.grupo-local { margin-bottom: 12px; }
.grupo-local .grupo-nome { font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
.checks.locais { gap: 8px; }
.checks.locais label { min-width: 64px; justify-content: center; padding: 10px 8px; }
.foto-previa { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.foto-previa img, img.foto-pre { max-width: 220px; max-height: 220px; border-radius: 8px; border: 1px solid var(--line); }
.abas { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.abas a { padding: 7px 12px; border-radius: 99px; border: 1px solid var(--line); background: #fff; text-decoration: none; color: var(--ink2); font-size: .9rem; }
.abas a.ativo { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.checks.locais .quebra { flex-basis: 100%; height: 0; }
