:root {
  --azul: #1f3a5f;
  --azul2: #2d5286;
  --fundo: #f3f5f8;
  --card: #fff;
  --borda: #dde2ea;
  --texto: #1d2330;
  --suave: #667085;
  --verde: #2e9e5b;
  --verde-bg: #ddf3e5;
  --amarelo: #c99700;
  --amarelo-bg: #fff3c4;
  --vermelho: #d14343;
  --vermelho-bg: #fbdcdc;
  --cinza: #7b818c;
  --cinza-bg: #e6e8ec;
  --r: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--fundo);
  color: var(--texto);
  padding-bottom: 76px;
}
a { color: var(--azul2); }
h1 { font-size: 1.35rem; margin: 0 0 12px; }
h2 { font-size: 1.1rem; margin: 22px 0 10px; }
h3 { font-size: 1rem; margin: 0 0 8px; }
small, .suave { color: var(--suave); }

/* topo e menu */
.topo { background: var(--azul); color: #fff; display: flex; align-items: center; gap: 16px; padding: 10px 16px; position: sticky; top: 0; z-index: 20; }
.marca { color: #fff; font-weight: 700; text-decoration: none; white-space: nowrap; }
.menu { display: flex; gap: 4px; margin-left: auto; }
.menu a { color: #cfdcef; text-decoration: none; padding: 7px 11px; border-radius: 8px; display: flex; gap: 6px; align-items: center; position: relative; }
.menu a.ativo, .menu a:hover { background: rgba(255,255,255,.14); color: #fff; }
.menu .ic { font-size: 1rem; }
.badge { background: var(--vermelho); color: #fff; font-size: .7rem; border-radius: 99px; padding: 1px 6px; }
@media (max-width: 760px) {
  .topo { padding: 10px 12px; }
  .menu { position: fixed; bottom: 0; left: 0; right: 0; background: var(--azul); justify-content: space-around; padding: 4px 2px calc(4px + env(safe-area-inset-bottom)); margin: 0; gap: 0; }
  .menu a { flex-direction: column; gap: 0; font-size: .7rem; padding: 6px 4px; flex: 1; text-align: center; }
  .menu .ic { font-size: 1.15rem; }
  .badge { position: absolute; top: 0; right: 14%; }
}

main { max-width: 1300px; margin: 0 auto; padding: 16px; }
@media (max-width: 760px) { main { padding: 12px; } }

.card { background: var(--card); border: 1px solid var(--borda); border-radius: var(--r); padding: 14px; margin-bottom: 12px; }
.grade { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.linha { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.linha.fim { justify-content: flex-end; }
.espaco { flex: 1; }

/* formulários */
label { display: block; font-size: .85rem; color: var(--suave); margin-bottom: 3px; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--borda); border-radius: 8px; background: #fff; color: var(--texto); max-width: 100%; }
textarea { width: 100%; min-height: 70px; }
.campo { margin-bottom: 10px; }
.campo input:not([type=checkbox]):not([type=radio]), .campo select { width: 100%; }
.filtros { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: flex-end; }
.filtros > div { min-width: 140px; }
@media (max-width: 760px) { .filtros > div { flex: 1 1 45%; } .filtros select { width: 100%; } }

button, .btn { font: inherit; border: 1px solid var(--borda); background: #fff; color: var(--texto); padding: 8px 14px; border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
button:hover, .btn:hover { border-color: var(--azul2); }
.primario { background: var(--azul2); border-color: var(--azul2); color: #fff; }
.primario:hover { background: var(--azul); }
.perigo { color: var(--vermelho); }
.pequeno { padding: 4px 9px; font-size: .85rem; }
button:disabled { opacity: .5; cursor: default; }

/* status */
.st { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.st.verde { background: var(--verde-bg); color: #1d7543; }
.st.amarelo { background: var(--amarelo-bg); color: #8a6700; }
.st.vermelho { background: var(--vermelho-bg); color: #a32b2b; }
.st.cinza { background: var(--cinza-bg); color: #4a4f57; }
.st.sem_dados { background: #f0f0f0; color: #888; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.verde { background: var(--verde); } .dot.amarelo { background: #f0c000; } .dot.vermelho { background: var(--vermelho); } .dot.cinza { background: var(--cinza); }

/* números do resumo */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-bottom: 12px; }
.kpi { background: var(--card); border: 1px solid var(--borda); border-radius: var(--r); padding: 10px 12px; }
.kpi b { font-size: 1.5rem; display: block; line-height: 1.1; }
.kpi span { font-size: .8rem; color: var(--suave); }
.kpi.amarelo { border-left: 5px solid #f0c000; } .kpi.vermelho { border-left: 5px solid var(--vermelho); } .kpi.cinza { border-left: 5px solid var(--cinza); } .kpi.verde { border-left: 5px solid var(--verde); }
.barra { height: 8px; background: #e9edf3; border-radius: 99px; overflow: hidden; margin: 6px 0; }
.barra i { display: block; height: 100%; background: var(--verde); }

/* cartões das lojas no painel */
.loja-card { cursor: pointer; text-decoration: none; color: inherit; display: block; }
.loja-card:hover { border-color: var(--azul2); }
.loja-card .pct { font-size: 1.8rem; font-weight: 700; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

/* tabelas */
.tabela-wrap { overflow: auto; background: #fff; border: 1px solid var(--borda); border-radius: var(--r); max-height: 75vh; }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th, td { padding: 6px 8px; border-bottom: 1px solid #edf0f4; text-align: left; vertical-align: middle; }
th { background: #f7f9fb; position: sticky; top: 0; z-index: 2; font-weight: 600; white-space: nowrap; }
.ficha td, .ficha th { border-right: 1px solid #edf0f4; }
.ficha .col-item { position: sticky; left: 0; background: #fff; z-index: 1; min-width: 210px; max-width: 280px; }
.ficha th.col-item { z-index: 3; background: #f7f9fb; }
.ficha .cat td { background: #eef2f8; font-weight: 700; position: sticky; left: 0; }
.ficha .x { text-align: center; font-weight: 700; color: #1d7543; background: #eaf7ef; cursor: pointer; }
.ficha .vazio { text-align: center; color: #cfd5de; }
.ficha .data { text-align: center; font-size: .78rem; min-width: 54px; }
.ficha .fixo { white-space: nowrap; text-align: center; }
.ficha tr.verde .col-status { background: var(--verde-bg); }
.ficha tr.amarelo .col-status { background: var(--amarelo-bg); }
.ficha tr.vermelho .col-status { background: var(--vermelho-bg); }
.ficha tr.cinza .col-status { background: var(--cinza-bg); }
.ficha tr.cinza .col-item { color: #777; }
.cod { color: var(--suave); font-size: .78rem; }
@media (max-width: 760px) { .ficha .col-item { min-width: 150px; max-width: 170px; } }

/* itens para agir */
.agir { display: flex; gap: 12px; align-items: flex-start; }
.agir .dias { min-width: 64px; text-align: center; border-radius: 10px; padding: 6px 4px; }
.agir .dias b { font-size: 1.5rem; display: block; line-height: 1; }
.agir .dias span { font-size: .7rem; }
.agir .dias.amarelo { background: var(--amarelo-bg); } .agir .dias.vermelho { background: var(--vermelho-bg); } .agir .dias.cinza { background: var(--cinza-bg); }
.agir .info { flex: 1; min-width: 0; }
.resultado { font-size: .85rem; padding: 4px 8px; border-radius: 6px; display: inline-block; margin-top: 4px; }
.resultado.voltou { background: var(--verde-bg); color: #1d7543; }
.resultado.nao_voltou { background: var(--vermelho-bg); color: #a32b2b; }
.resultado.aguardando { background: #eef2f8; color: #3c4a60; }

/* revisão do PDF */
.upload { border: 2px dashed #b9c4d4; border-radius: var(--r); padding: 26px 16px; text-align: center; background: #fff; cursor: pointer; }
.upload.sobre { border-color: var(--azul2); background: #eef4fc; }
.revisao table input { width: 100%; padding: 5px 6px; }
.revisao td.qtd { width: 80px; }
.revisao td.cod-in { width: 120px; }
.aviso { background: #fff7e0; border: 1px solid #f1d27a; padding: 8px 10px; border-radius: 8px; margin: 6px 0; font-size: .9rem; }
.erro { background: var(--vermelho-bg); border: 1px solid #eba6a6; padding: 8px 10px; border-radius: 8px; margin: 6px 0; }
.ok { background: var(--verde-bg); border: 1px solid #9fd8b4; padding: 8px 10px; border-radius: 8px; margin: 6px 0; }
.fora { background: #fff7e0; }
pre.txt { white-space: pre-wrap; font-size: .75rem; background: #f7f9fb; padding: 10px; border-radius: 8px; max-height: 300px; overflow: auto; }

/* modal e aviso rápido */
.modal { position: fixed; inset: 0; background: rgba(15,25,40,.5); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 30px 12px; overflow: auto; }
.modal[hidden] { display: none; }
.modal-box { background: #fff; border-radius: 14px; padding: 18px; width: 100%; max-width: 560px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 90px; background: #1d2330; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 60; max-width: 90vw; }
.opcoes label { display: flex; gap: 8px; align-items: center; color: var(--texto); font-size: .95rem; margin: 5px 0; }
.simnao { display: flex; gap: 6px; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #f0f2f5; }
.simnao .grp { display: flex; gap: 4px; }
.simnao input { display: none; }
.simnao .grp label { margin: 0; border: 1px solid var(--borda); padding: 4px 10px; border-radius: 8px; cursor: pointer; color: var(--texto); }
.simnao input:checked + label.s { background: var(--verde-bg); border-color: var(--verde); }
.simnao input:checked + label.n { background: var(--vermelho-bg); border-color: var(--vermelho); }
.foto { max-width: 120px; max-height: 120px; border-radius: 8px; display: block; margin-top: 6px; }

/* relatório para o comprador */
body.relatorio-modo .topo { display: none; }
body.relatorio-modo { background: #fff; padding-bottom: 0; }
.rel h1 { margin-bottom: 2px; }
.rel table { margin-bottom: 18px; border: 1px solid var(--borda); }
.rel h2 { border-bottom: 2px solid var(--azul); padding-bottom: 4px; }
@media print {
  .nao-imprime { display: none !important; }
  main { max-width: none; padding: 0; }
  .rel table { font-size: 10pt; }
  .tabela-wrap { max-height: none; overflow: visible; border: 0; }
  th { position: static; }
}
.vazio-msg { text-align: center; padding: 30px 10px; color: var(--suave); }

/* abas da ficha */
.abas { display: flex; gap: 6px; margin-bottom: 12px; border-bottom: 2px solid var(--borda); }
.abas a { padding: 8px 14px; text-decoration: none; color: var(--suave); border-radius: 8px 8px 0 0; margin-bottom: -2px; border-bottom: 3px solid transparent; }
.abas a.ativo { color: var(--azul); font-weight: 700; border-bottom-color: var(--azul2); }
@media (max-width: 760px) { .abas a { padding: 8px 8px; font-size: .9rem; } .abas small { display: none; } }

/* comparar lojas */
.comparar .loja-th { text-align: center; white-space: normal; min-width: 92px; font-size: .8rem; }
.comparar .loja-th a { color: var(--azul); text-decoration: none; }
.cmp, .cmp-cat { text-align: center; font-weight: 600; }
.cmp.verde { background: var(--verde-bg); color: #1d7543; }
.cmp.amarelo { background: var(--amarelo-bg); color: #8a6700; }
.cmp.vermelho { background: var(--vermelho-bg); color: #a32b2b; }
.cmp.cinza { background: var(--cinza-bg); color: #4a4f57; }
.cmp.naopediu { background: #fde2e2; color: var(--vermelho); font-size: 1.05rem; }
.cmp.nao-cad { color: #c4c9d2; font-weight: 400; }
.comparar .cat td { position: static; }
.comparar .cat td.col-item { position: sticky; left: 0; z-index: 1; }
.cmp-cat { font-size: .8rem; color: #1d7543; }
.cmp-cat.tem { color: var(--vermelho); }
.txt-verm { color: var(--vermelho); }
.legenda { font-size: .85rem; color: var(--suave); }
.cmp-ex { display: inline-block; min-width: 28px; text-align: center; border-radius: 4px; padding: 1px 4px; font-weight: 600; }
.cmp-ex.naopediu { background: #fde2e2; color: var(--vermelho); }
.cmp-ex.verde { background: var(--verde-bg); color: #1d7543; }
.cmp-ex.nao-cad { color: #aab; }

/* conferência de códigos */
.conf-lado { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.conf-lado > div { background: #f7f9fb; border-radius: 8px; padding: 8px 10px; font-size: .9rem; }
@media (max-width: 760px) { .conf-lado { grid-template-columns: 1fr; } }
.revisao tr.conf-linha td { background: #fff4f4; border-bottom: 2px solid #f3c9c9; }

/* login e conta */
body.sem-login .menu, body.sem-login .conta { display: none; }
.login-box { max-width: 380px; margin: 8vh auto 0; display: flex; flex-direction: column; gap: 10px; }
.login-box label { display: flex; flex-direction: column; gap: 4px; font-size: .92rem; }
.login-box input { width: 100%; }
.login-marca { font-size: 1.35rem; font-weight: 700; color: var(--azul); }
.conta { position: relative; margin-left: 6px; }
.conta-btn { background: rgba(255,255,255,.12); border-color: transparent; color: #fff; padding: 6px 10px; }
.conta-btn:hover { background: rgba(255,255,255,.22); border-color: transparent; }
.conta-menu { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--borda); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.15); display: flex; flex-direction: column; min-width: 220px; z-index: 40; overflow: hidden; }
.conta-menu button { border: 0; border-radius: 0; justify-content: flex-start; padding: 11px 14px; }
.conta-menu button:hover { background: #f1f5fa; }
.senha-prov { background: #f7f9fb; border: 1px dashed var(--borda); border-radius: 8px; padding: 10px 12px; line-height: 1.7; }
tr.inativo td { color: #999; }
@media (max-width: 760px) { .conta { margin-left: auto; } }
[hidden] { display: none !important; }
