:root {
  --amarelo: #f4c430;
  --tinta: #1d1b16;
  --fundo: #f5f2ea;
  --superficie: #ffffff;
  --superficie-2: #f7f5ef;
  --texto: #1d1b16;
  --suave: #62594b;
  --linha: #e4ddcd;
  --verde: #0f7038;
  --verde-fundo: #e9f6ee;
  --ambar: #8a4f00;
  --ambar-fundo: #fff4d9;
  --ambar-linha: #f1d493;
  --foco: #1f5fd6;
  --sombra: 0 1px 2px rgba(29, 27, 22, .06), 0 2px 8px rgba(29, 27, 22, .05);
  --lateral: max(12px, env(safe-area-inset-left));
  --lateral-dir: max(12px, env(safe-area-inset-right));
  --altura-abas: 62px;
  --altura-botao: 37px; /* botões do cartão e o container de estoque */

  /* status do pedido (aba Anunciados) */
  --st-anunciado: #5c5345;   --st-anunciado-fundo: #efeadf;
  --st-negociando: #1f5fd6;  --st-negociando-fundo: #e7eefc;
  --st-reservado: #8a4f00;   --st-reservado-fundo: #fff1d6;
  --st-vendido: #0f7038;     --st-vendido-fundo: #e5f5ea;
  --st-entregue: #5b3cc4;    --st-entregue-fundo: #eee9fb;
  --st-cancelado: #b42318;   --st-cancelado-fundo: #fdeceb;
  --sobre-status: #ffffff;
  --whatsapp: #128c4a;
  --loja-0: #0369a1; --loja-1: #a21caf; --loja-2: #c2410c; --loja-3: #0f766e;
  --fogo: #c2410c;     /* "Mais vendidos" */
  --grafico: #c98500;  /* barras do relatório de vendas: contraste de 3:1 nos dois temas */
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fundo: #12110f;
    --superficie: #1c1a17;
    --superficie-2: #24221e;
    --texto: #f3efe6;
    --suave: #b9b1a2;
    --linha: #36322b;
    --verde: #5fd08b;
    --verde-fundo: #16291e;
    --ambar: #f3bd5b;
    --ambar-fundo: #2b2213;
    --ambar-linha: #5a4520;
    --foco: #7fb0ff;
    --sombra: 0 1px 2px rgba(0, 0, 0, .4);
    --st-anunciado: #d8d0c0;   --st-anunciado-fundo: #2a2723;
    --st-negociando: #8fb4ff;  --st-negociando-fundo: #1b2740;
    --st-reservado: #f3bd5b;   --st-reservado-fundo: #2b2213;
    --st-vendido: #5fd08b;     --st-vendido-fundo: #16291e;
    --st-entregue: #b9a6ff;    --st-entregue-fundo: #231d3b;
    --st-cancelado: #ff8a80;   --st-cancelado-fundo: #3a1a18;
    --sobre-status: #121110;
    --whatsapp: #4fd184;
    --loja-0: #7dd3fc; --loja-1: #f0abfc; --loja-2: #fdba74; --loja-3: #5eead4;
    --fogo: #fdba74;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --fundo: #12110f;
  --superficie: #1c1a17;
  --superficie-2: #24221e;
  --texto: #f3efe6;
  --suave: #b9b1a2;
  --linha: #36322b;
  --verde: #5fd08b;
  --verde-fundo: #16291e;
  --ambar: #f3bd5b;
  --ambar-fundo: #2b2213;
  --ambar-linha: #5a4520;
  --foco: #7fb0ff;
  --sombra: 0 1px 2px rgba(0, 0, 0, .4);
  --st-anunciado: #d8d0c0;   --st-anunciado-fundo: #2a2723;
  --st-negociando: #8fb4ff;  --st-negociando-fundo: #1b2740;
  --st-reservado: #f3bd5b;   --st-reservado-fundo: #2b2213;
  --st-vendido: #5fd08b;     --st-vendido-fundo: #16291e;
  --st-entregue: #b9a6ff;    --st-entregue-fundo: #231d3b;
  --st-cancelado: #ff8a80;   --st-cancelado-fundo: #3a1a18;
  --sobre-status: #121110;
  --whatsapp: #4fd184;
  --loja-0: #7dd3fc; --loja-1: #f0abfc; --loja-2: #fdba74; --loja-3: #5eead4;
  --fogo: #fdba74;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--fundo);
  color: var(--texto);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--altura-abas) + 12px + env(safe-area-inset-bottom));
}
body.digitando { padding-bottom: 0; }

button, input, select { font: inherit; color: inherit; }

:focus-visible { outline: 3px solid var(--foco); outline-offset: 2px; }

[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.pular {
  position: absolute; left: 8px; top: -60px; z-index: 50;
  background: var(--tinta); color: #fff; padding: 10px 14px; border-radius: 8px;
}
.pular:focus { top: 8px; }

/* Ícones desenhados só com traço: a cor vem do texto em volta */
.ic {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.ic .ponto { fill: currentColor; stroke: none; }

/* ---------- status do pedido: cada classe define as cores usadas pelos componentes ---------- */

.status-anunciado  { --st: var(--st-anunciado);  --st-fundo: var(--st-anunciado-fundo); }
.status-negociando { --st: var(--st-negociando); --st-fundo: var(--st-negociando-fundo); }
.status-reservado  { --st: var(--st-reservado);  --st-fundo: var(--st-reservado-fundo); }
.status-vendido    { --st: var(--st-vendido);    --st-fundo: var(--st-vendido-fundo); }
.status-entregue   { --st: var(--st-entregue);   --st-fundo: var(--st-entregue-fundo); }
.status-cancelado  { --st: var(--st-cancelado);  --st-fundo: var(--st-cancelado-fundo); }

/* ---------- topo ---------- */

.topo {
  background: var(--amarelo);
  color: var(--tinta);
  padding: max(10px, env(safe-area-inset-top)) var(--lateral-dir) 10px var(--lateral);
}

.topo-conteudo, .lojas, .painel > *, .conteudo { max-width: 1080px; margin-left: auto; margin-right: auto; }

.topo-conteudo { display: flex; align-items: center; gap: 10px; }

.logo {
  flex: none; width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--tinta); color: var(--amarelo);
  font-weight: 800; font-size: 20px; letter-spacing: -.02em;
}

.titulo h1 { margin: 0; font-size: 18px; line-height: 1.15; font-weight: 800; letter-spacing: -.01em; }

/* círculo com as iniciais do vendedor: abre a gaveta do perfil */
.avatar {
  flex: none; margin-left: auto; width: 40px; height: 40px; padding: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  border: 2px solid var(--tinta); background: #fff; color: var(--tinta);
  font-weight: 800; font-size: 15px; letter-spacing: .02em; line-height: 1;
}
.avatar .ic { width: 22px; height: 22px; stroke-width: 2; }
.avatar:active { background: var(--fundo); }

/* seletor de loja: as mesmas abas da barra de baixo (.aba), numa faixa dentro do topo */
.lojas {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px;
  margin-top: 10px; padding: 5px; border-radius: 16px;
  background: var(--superficie); box-shadow: 0 2px 10px rgba(29, 27, 22, .12);
}
.lojas .aba { border: 0; background: transparent; cursor: pointer; padding: 3px 2px; line-height: 1.15; text-align: center; }

/* ---------- painel fixo: busca + classificadores ---------- */

.painel {
  position: sticky; top: 0; z-index: 10;
  background: var(--superficie);
  border-bottom: 1px solid var(--linha);
  box-shadow: 0 2px 10px rgba(29, 27, 22, .06);
  padding: 8px var(--lateral-dir) 8px var(--lateral);
}

.busca { display: flex; gap: 8px; }

.campo-busca { position: relative; flex: 1; min-width: 0; }

.campo-busca .icone {
  position: absolute; left: 11px; top: 50%; margin-top: -10px;
  color: var(--suave); stroke-width: 2.2; pointer-events: none;
}

.campo-busca input {
  width: 100%; height: 44px; padding: 0 42px 0 38px;
  border: 1.5px solid var(--linha); border-radius: 11px;
  background: var(--superficie-2); font-size: 17px;
  appearance: none; -webkit-appearance: none;
}
.campo-busca input::placeholder { color: var(--suave); opacity: 1; }
.campo-busca input:focus { border-color: var(--foco); background: var(--superficie); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--foco) 22%, transparent); }
.campo-busca input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }

.limpar {
  position: absolute; right: 2px; top: 2px; width: 40px; height: 40px;
  border: 0; border-radius: 10px; background: transparent; cursor: pointer;
  display: grid; place-items: center; color: var(--suave);
}
.limpar .ic { stroke-width: 2.4; }

.botao-buscar {
  flex: none; height: 44px; padding: 0 14px; border: 0; border-radius: 11px; cursor: pointer;
  background: var(--tinta); color: #fff; font-weight: 700; font-size: 16px;
}
:root[data-theme="dark"] .botao-buscar { background: var(--amarelo); color: var(--tinta); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .botao-buscar { background: var(--amarelo); color: var(--tinta); }
}

/* classificadores: retangulares com cantos arredondados (as categorias, em pílulas, ficam logo abaixo) */
.ordens { display: flex; gap: 6px; margin-top: 8px; }
.ordem {
  flex: 1 1 auto; min-width: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-height: 40px; padding: 0 8px; border-radius: 10px; cursor: pointer;
  border: 1.5px solid var(--linha); background: var(--superficie-2); color: var(--texto);
  font-size: 14.5px; font-weight: 700; white-space: nowrap;
}
.ordem .ic { width: 17px; height: 17px; stroke-width: 2; color: var(--suave); }
#abrir-ordem, #abrir-filtro { flex: 1 1 0; justify-content: flex-start; padding: 0 8px 0 10px; }
.ordem-texto { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ordem .ordem-abrir { flex: none; width: 16px; height: 16px; margin-left: auto; }
/* filtro escolhido: o botão fica destacado como um classificador ligado */
.ordem.ativo { background: var(--tinta); border-color: var(--tinta); color: #fff; }
.ordem.ativo .ic { color: var(--amarelo); }
:root[data-theme="dark"] .ordem.ativo { background: var(--amarelo); border-color: var(--amarelo); color: var(--tinta); }
:root[data-theme="dark"] .ordem.ativo .ic { color: var(--tinta); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ordem.ativo { background: var(--amarelo); border-color: var(--amarelo); color: var(--tinta); }
  :root:not([data-theme="light"]) .ordem.ativo .ic { color: var(--tinta); }
}
/* botão selecionado (classificadores e tema): escuro no tema claro, amarelo no tema escuro */
.ordem[aria-pressed="true"], .tema[aria-pressed="true"] { background: var(--tinta); border-color: var(--tinta); color: #fff; }
.ordem[aria-pressed="true"] .ic, .tema[aria-pressed="true"] .ic { color: var(--amarelo); }
:root[data-theme="dark"] .ordem[aria-pressed="true"], :root[data-theme="dark"] .tema[aria-pressed="true"] { background: var(--amarelo); border-color: var(--amarelo); color: var(--tinta); }
:root[data-theme="dark"] .ordem[aria-pressed="true"] .ic, :root[data-theme="dark"] .tema[aria-pressed="true"] .ic { color: var(--tinta); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ordem[aria-pressed="true"], :root:not([data-theme="light"]) .tema[aria-pressed="true"] { background: var(--amarelo); border-color: var(--amarelo); color: var(--tinta); }
  :root:not([data-theme="light"]) .ordem[aria-pressed="true"] .ic, :root:not([data-theme="light"]) .tema[aria-pressed="true"] .ic { color: var(--tinta); }
}

/* ---------- conteúdo ---------- */

.conteudo { padding: 10px var(--lateral-dir) 20px var(--lateral); }

.aviso {
  margin: 0 0 10px; padding: 12px 14px; border-radius: 12px;
  background: var(--ambar-fundo); border: 1px solid var(--ambar-linha); color: var(--texto); font-size: 15px;
}

.atalhos {
  display: flex; gap: 8px; margin: 0 calc(-1 * var(--lateral-dir)) 10px calc(-1 * var(--lateral));
  padding: 2px var(--lateral-dir) 4px var(--lateral);
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.atalhos::-webkit-scrollbar { display: none; }

.atalho {
  flex: none; scroll-snap-align: start;
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 42px; padding: 0 14px 0 11px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--linha); background: var(--superficie); color: var(--texto);
  font-size: 15px; font-weight: 600; white-space: nowrap;
}
.atalho .ic { width: 22px; height: 22px; color: var(--suave); }
.atalho-qtd { color: var(--suave); font-weight: 500; font-variant-numeric: tabular-nums; }
#filtro-vendidos > .ic, .folha-vendidos > .ic:first-child, .selo-vendido .ic { color: var(--fogo); }
.folha-parados > .ic:first-child { color: var(--ambar); }
.atalho:active { background: var(--superficie-2); }

.barra-resultados { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; min-height: 30px; }
.contagem { flex: 1; min-width: 0; margin: 0; font-size: 14px; color: var(--suave); }
.selecionar {
  flex: none; margin-left: auto; display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 0 10px;
  border: 1.5px solid var(--linha); border-radius: 10px; background: var(--superficie); color: var(--texto);
  font-size: 14px; font-weight: 700; cursor: pointer;
}
.selecionar .ic { width: 17px; height: 17px; color: var(--whatsapp); }
.contagem strong { color: var(--texto); }

/* busca: os produtos sem estoque (preço para encomenda) vêm depois, com este separador */
.separador-lista {
  display: flex; align-items: center; gap: 10px; margin: 6px 2px 0; list-style: none;
  font-size: 12.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--suave);
}
.separador-lista::after { content: ""; flex: 1; height: 1px; background: var(--linha); }

/* filtro ativo (fornecedor, parados ou sem estoque) */
.filtro-ativo {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 10px; padding: 5px 5px 5px 10px; border-radius: 10px;
  border: 1.5px solid var(--texto); background: var(--superficie); font-size: 14.5px;
}
.filtro-ativo > .ic { width: 20px; height: 20px; color: var(--suave); }
.filtro-ativo > span { flex: 1; min-width: 0; line-height: 1.3; overflow-wrap: anywhere; }
.filtro-ativo button {
  flex: none; width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer;
  border: 0; border-radius: 8px; background: var(--superficie-2); color: var(--texto);
}
.filtro-ativo button .ic { width: 18px; height: 18px; stroke-width: 2.2; }

/* a busca também é nome de fornecedor */
.sugestao-fornecedor { display: flex; align-items: flex-start; gap: 6px; margin: -2px 0 8px; font-size: 14px; color: var(--suave); line-height: 1.35; }
.sugestao-fornecedor > .ic { width: 18px; height: 18px; margin-top: 1px; }
.sugestao-fornecedor .link { padding: 0; text-align: left; }

/* busca sem resultado: buscar por fornecedor */
.vazio-fornecedores { max-width: 520px; margin: 18px auto 0; text-align: left; }
.vazio-fornecedores .fornecedores-titulo { display: flex; align-items: center; gap: 6px; margin: 0 0 2px; font-size: 16px; font-weight: 800; color: var(--texto); }
.vazio-fornecedores .fornecedores-titulo .ic { width: 20px; height: 20px; }
.fornecedor-opcao {
  display: flex; align-items: center; gap: 8px; width: 100%;
  min-height: 46px; margin: 0 0 6px; padding: 8px 8px 8px 12px; border-radius: 10px; cursor: pointer; text-align: left;
  border: 1.5px solid var(--linha); background: var(--superficie); color: var(--texto);
  font-size: 15px; font-weight: 600; line-height: 1.25;
}
.fornecedor-opcao:active { background: var(--superficie-2); }
.fornecedor-nome { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.fornecedor-qtd { flex: none; color: var(--suave); font-weight: 700; font-variant-numeric: tabular-nums; }
.fornecedor-opcao .ic { width: 18px; height: 18px; color: var(--suave); }
.vazio-fornecedores > .botao-secundario { display: flex; margin: 0 auto; }

.link {
  border: 0; background: none; padding: 6px 0; cursor: pointer;
  font: inherit; font-weight: 700; color: var(--foco); text-decoration: underline; text-underline-offset: 3px;
}

.botao-secundario {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: 12px; cursor: pointer;
  border: 1.5px solid var(--linha); background: var(--superficie); color: var(--texto); font-weight: 700;
}
.botao-secundario .ic { width: 18px; height: 18px; }

.lista { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }

/* ---------- cartão do produto (compacto) ---------- */

.card {
  background: var(--superficie); border: 1px solid var(--linha); border-radius: 12px;
  box-shadow: var(--sombra); padding: 8px 9px 8px 11px;
  scroll-margin-top: 140px;
}

/* primeira linha: nome (sem quebrar, com "…" quando não cabe) e, à direita, a loja */
.linha-nome { display: flex; align-items: center; gap: 8px; }
.nome {
  flex: 1 1 auto; min-width: 0; margin: 0;
  font-size: 16px; line-height: 1.3; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* "Novo" (entrou numa atualização recente) e tempo sem venda (filtro "Parados") */
.selo-novo {
  flex: none; padding: 0 7px; border-radius: 999px; line-height: 18px;
  background: var(--verde); color: var(--sobre-status); font-size: 11px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase;
}
.selo-parado {
  flex: none; display: inline-flex; align-items: center; gap: 2px; padding: 0 7px 0 5px; border-radius: 999px; line-height: 18px;
  background: var(--ambar-fundo); color: var(--ambar); font-size: 12px; font-weight: 800; white-space: nowrap;
}
.selo-parado .ic { width: 13px; height: 13px; stroke-width: 2.2; }
.selo-vendido {
  flex: none; display: inline-flex; align-items: center; gap: 2px; padding: 0 7px 0 5px; border-radius: 999px; line-height: 18px;
  background: var(--ambar-fundo); color: var(--texto); font-size: 12px; font-weight: 800; white-space: nowrap;
}
.selo-vendido .ic { width: 13px; height: 13px; stroke-width: 2.2; }

/* seleção de vários produtos para o WhatsApp */
.marcador {
  display: none; flex: none; width: 26px; height: 26px; padding: 0; border-radius: 50%; cursor: pointer;
  place-items: center; border: 2px solid var(--linha); background: var(--superficie); color: transparent;
}
.marcador .ic { width: 16px; height: 16px; stroke-width: 3; }
body.selecionando .marcador { display: grid; }
body.selecionando .lista .card { cursor: pointer; }
.card.selecionado { border-color: var(--whatsapp); box-shadow: 0 0 0 2px var(--whatsapp); }
.card.selecionado .marcador { border-color: var(--whatsapp); background: var(--whatsapp); color: #fff; }

.barra-selecao {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 22;
  bottom: calc(var(--altura-abas) + 10px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 10px; width: min(460px, calc(100vw - 24px));
  padding: 6px 6px 6px 8px; border-radius: 16px; background: var(--tinta); color: #fff;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .28);
}
.barra-selecao-fechar {
  flex: none; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 12px; cursor: pointer;
  background: rgba(255, 255, 255, .12); color: #fff;
}
.barra-selecao-texto { flex: 1; min-width: 0; font-weight: 800; font-size: 15px; }
.barra-selecao-enviar {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 16px; border-radius: 12px;
  background: #1faa59; color: #fff; font-weight: 800; text-decoration: none;
}
.barra-selecao-enviar .ic { width: 20px; height: 20px; }
.barra-selecao-enviar.desativado { opacity: .45; pointer-events: none; }
body.selecionando { padding-bottom: calc(var(--altura-abas) + 84px + env(safe-area-inset-bottom)); }
body.selecionando .toast { bottom: calc(var(--altura-abas) + 76px + env(safe-area-inset-bottom)); }

/* loja do produto, em "Todas as lojas": cada loja com a sua cor no texto */
.selo-loja {
  flex: none; margin-left: auto;
  display: inline-flex; align-items: center; gap: 2px;
  padding: 0 7px 0 4px; border-radius: 999px;
  border: 1px solid var(--linha); background: var(--superficie-2); color: var(--suave);
  font-size: 12px; font-weight: 800; line-height: 18px; white-space: nowrap;
}
.selo-loja .ic { width: 13px; height: 13px; stroke-width: 2.2; }
.selo-loja.cor-loja-0 { color: var(--loja-0); }
.selo-loja.cor-loja-1 { color: var(--loja-1); }
.selo-loja.cor-loja-2 { color: var(--loja-2); }
.selo-loja.cor-loja-3 { color: var(--loja-3); }

.linha-principal { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

.valor { font-size: 17px; line-height: 1.2; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.valor.confirmar { font-size: 14px; font-weight: 700; color: var(--ambar); white-space: normal; line-height: 1.1; max-width: 5.6em; }

/* estoque: container do tamanho dos botões, à esquerda do botão de anunciar;
   verde com várias unidades, âmbar na última, vermelho discreto sem estoque */
.estoque {
  flex: none; display: inline-flex; align-items: center; gap: 3px;
  height: var(--altura-botao); padding: 0 8px 0 6px; border-radius: 10px;
  border: 1.5px solid transparent; border-color: color-mix(in srgb, currentColor 22%, transparent);
  background: var(--verde-fundo); color: var(--verde); font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums;
}
.estoque .ic { width: 17px; height: 17px; stroke-width: 2; }
.estoque.ultima { background: var(--ambar-fundo); color: var(--ambar); }
.estoque.fora { background: var(--st-cancelado-fundo); color: var(--st-cancelado); } /* sem estoque: vermelho discreto */

.botoes { display: flex; gap: 4px; margin-left: auto; }

.icone-botao {
  display: grid; place-items: center; width: var(--altura-botao); height: var(--altura-botao); flex: none;
  border: 1.5px solid var(--linha); border-radius: 10px; background: var(--superficie); color: var(--texto);
  cursor: pointer; text-decoration: none;
}
.icone-botao .ic { width: 20px; height: 20px; }
.icone-botao:active { background: var(--superficie-2); }
.icone-botao.ativo { background: var(--st-fundo); border-color: var(--st); color: var(--st); }
.icone-botao.ver-detalhes .ic { transition: transform .15s ease; }
.icone-botao.ver-detalhes[aria-expanded="true"] { background: var(--superficie-2); }
.icone-botao.ver-detalhes[aria-expanded="true"] .ic { transform: rotate(180deg); }
.icone-botao.remover { color: var(--st-cancelado); }
.icone-botao.whatsapp { color: var(--whatsapp); }

.nota { margin: 5px 0 0; font-size: 13px; color: var(--suave); }

/* "ver mais": tudo na mesma fonte do nome do sistema (largura fixa) e em maiúsculas; negrito e cores
   de cada linha continuam */
dl.detalhes {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 12px;
  margin: 8px 0 2px; padding: 10px 12px; border-radius: 10px; background: var(--superficie-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; text-transform: uppercase;
}
.detalhes dt { color: var(--suave); }
.detalhes dd { margin: 0; overflow-wrap: anywhere; font-weight: 600; }
.detalhes .sistema { font-weight: 500; }
/* contas (preço mínimo, comissão, custo, imposto e sobra): cor de destaque, sem negrito extra;
   o olhinho da gaveta esconde todas */
.detalhes dd.conta { font-variant-numeric: tabular-nums; }
.detalhes dd.minimo { color: var(--ambar); }
.detalhes dd.ganho, .detalhes dd.positivo { color: var(--verde); }
.detalhes .origem { color: var(--suave); font-weight: 500; }
html.ocultar-contas .detalhes .conta { display: none; }

/* ---------- aba Anunciados ---------- */

.painel-anunciados { padding-bottom: 2px; }
.anunciados-topo { display: flex; align-items: baseline; justify-content: space-between; gap: 2px 12px; flex-wrap: wrap; }
.anunciados-topo h2 { margin: 0; font-size: 19px; font-weight: 800; }
.filtros-status { margin-top: 6px; margin-bottom: 4px; }
.filtros-status .atalho { min-height: 38px; }
.filtros-status .atalho[class*="status-"] .ic { color: var(--st); }
.filtros-status .atalho[aria-pressed="true"] { background: var(--tinta); border-color: var(--tinta); color: #fff; }
.filtros-status .atalho[aria-pressed="true"] .ic,
.filtros-status .atalho[aria-pressed="true"] .atalho-qtd { color: #fff; }
:root[data-theme="dark"] .filtros-status .atalho[aria-pressed="true"] { background: var(--amarelo); border-color: var(--amarelo); color: var(--tinta); }
:root[data-theme="dark"] .filtros-status .atalho[aria-pressed="true"] .ic,
:root[data-theme="dark"] .filtros-status .atalho[aria-pressed="true"] .atalho-qtd { color: var(--tinta); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .filtros-status .atalho[aria-pressed="true"] { background: var(--amarelo); border-color: var(--amarelo); color: var(--tinta); }
  :root:not([data-theme="light"]) .filtros-status .atalho[aria-pressed="true"] .ic,
  :root:not([data-theme="light"]) .filtros-status .atalho[aria-pressed="true"] .atalho-qtd { color: var(--tinta); }
}


.anuncio { border-left: 5px solid var(--st); }
.status-grade { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; margin-top: 8px; }

.status-opcao {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 46px; padding: 4px 2px; border-radius: 10px; cursor: pointer;
  border: 1.5px solid var(--linha); background: var(--superficie); color: var(--texto);
  font-size: 12.5px; font-weight: 700; line-height: 1.1; white-space: nowrap;
}
.status-opcao .ic { width: 20px; height: 20px; color: var(--st); }
.status-opcao[aria-pressed="true"] { background: var(--st); border-color: var(--st); color: var(--sobre-status); }
.status-opcao[aria-pressed="true"] .ic { color: var(--sobre-status); }

.historico { margin: 6px 0 0; font-size: 12.5px; color: var(--suave); }


.destaque { animation: destaque 1.6s ease; }
@keyframes destaque { 0%, 60% { box-shadow: 0 0 0 4px var(--amarelo); } 100% { box-shadow: var(--sombra); } }

/* ---------- gaveta do perfil: nome, comissão e desconto ---------- */

html.travado, html.travado body { overflow: hidden; }

.camada { position: fixed; inset: 0; z-index: 40; background: rgba(18, 16, 12, .45); animation: aparece .2s ease; }

.gaveta {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 41;
  width: min(360px, 90vw); overflow-y: auto; overscroll-behavior: contain;
  background: var(--superficie); color: var(--texto);
  border-left: 1px solid var(--linha); box-shadow: -10px 0 32px rgba(0, 0, 0, .18);
  padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) 16px;
  animation: gaveta-entra .22s ease;
}
.gaveta:focus { outline: none; }
@keyframes gaveta-entra { from { transform: translateX(100%); } to { transform: none; } }
@keyframes aparece { from { opacity: 0; } to { opacity: 1; } }

.gaveta-topo { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--linha); }
.avatar-grande { width: 48px; height: 48px; margin-left: 0; font-size: 18px; cursor: default; background: var(--amarelo); border-color: var(--amarelo); color: var(--tinta); }
.gaveta-titulos { flex: 1; min-width: 0; }
.gaveta-titulos h2 { margin: 0; font-size: 18px; font-weight: 800; }

.fechar {
  flex: none; width: 42px; height: 42px; display: grid; place-items: center; cursor: pointer;
  border: 0; border-radius: 12px; background: var(--superficie-2); color: var(--texto);
}
.fechar .ic { stroke-width: 2.2; }

.campo { margin-top: 18px; }
.campo > .campo-rotulo { margin-bottom: 6px; }
.campo-linha { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; }
.campo-rotulo { display: flex; align-items: center; gap: 6px; font-size: 16px; font-weight: 700; }
.campo-rotulo .ic { width: 20px; height: 20px; stroke-width: 2; }
.campo-rotulo .ic-ganho { color: var(--verde); }
.campo-rotulo .ic-minimo { color: var(--ambar); }

.campo-texto {
  width: 100%; height: 48px; padding: 0 14px;
  border: 1.5px solid var(--linha); border-radius: 12px; background: var(--superficie-2);
  font-size: 17px; font-weight: 600; color: var(--texto);
}
.campo-texto::placeholder { color: var(--suave); opacity: 1; font-weight: 500; }
.campo-texto[aria-invalid="true"] { border-color: var(--st-cancelado); }

/* o "%" fica dentro do campo */
.ajuste-campo { position: relative; flex: none; display: block; }
.ajuste-campo > span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; font-size: 17px; font-weight: 700; color: var(--suave); }
.ajuste-campo input {
  width: 6em; height: 48px; padding: 0 32px 0 10px; text-align: right;
  border: 1.5px solid var(--linha); border-radius: 12px; background: var(--superficie-2);
  font-size: 20px; font-weight: 800; color: var(--texto); font-variant-numeric: tabular-nums;
}
.ajuste-campo input::placeholder { color: var(--suave); opacity: .7; }

.campo-texto:focus, .ajuste-campo input:focus {
  outline: none; border-color: var(--foco); background: var(--superficie);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--foco) 22%, transparent);
}

.botao-principal {
  display: block; width: 100%; min-height: 50px; margin-top: 24px; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--tinta); color: #fff; font-size: 17px; font-weight: 800;
}
:root[data-theme="dark"] .botao-principal { background: var(--amarelo); color: var(--tinta); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .botao-principal { background: var(--amarelo); color: var(--tinta); }
}


/* olhinho: mostra ou esconde comissão e desconto nos cartões */
.grupo-contas { margin-top: 22px; }
.grupo-contas + .campo { margin-top: 10px; }
.olho {
  flex: none; width: 42px; height: 42px; display: grid; place-items: center; cursor: pointer;
  border: 1.5px solid var(--linha); border-radius: 12px; background: var(--superficie-2); color: var(--texto);
}
.olho .ic { width: 22px; height: 22px; }
.olho[aria-pressed="true"] .olho-fechado, .olho[aria-pressed="false"] .olho-aberto { display: none; }
.olho[aria-pressed="false"] { color: var(--suave); }

/* tema: claro, escuro ou automático */
.temas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.tema {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 58px; padding: 6px 4px; border-radius: 10px; cursor: pointer;
  border: 1.5px solid var(--linha); background: var(--superficie-2); color: var(--texto);
  font-size: 13.5px; font-weight: 700; line-height: 1.1;
}
.tema .ic { width: 22px; height: 22px; color: var(--suave); }

/* ---------- administrador: atualização do estoque pelos relatórios do sistema ---------- */

.admin { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--linha); }
.admin-titulo { margin: 0 0 10px; font-size: 16px; font-weight: 800; }
.admin-entrar { display: flex; gap: 8px; }
.admin-entrar .campo-texto { flex: 1; min-width: 0; font-size: 16px; }
.admin-entrar .botao-secundario { flex: none; min-height: 48px; }
.admin .erro { margin-top: 10px; }

.admin-arquivos { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.arquivo {
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 12px; cursor: pointer;
  border: 1.5px dashed var(--linha); border-radius: 12px; background: var(--superficie-2);
}
.arquivo:focus-within { border-color: var(--foco); }
.arquivo .ic { width: 22px; height: 22px; color: var(--suave); }
.arquivo-textos { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.arquivo-loja { font-weight: 800; font-size: 15px; }
.arquivo-nome { font-size: 13px; color: var(--suave); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arquivo.escolhido { border-style: solid; border-color: var(--verde); }
.arquivo.escolhido .ic, .arquivo.escolhido .arquivo-nome { color: var(--verde); }
.admin .botao-principal { margin-top: 12px; }
.admin .botao-principal:disabled { opacity: .6; cursor: default; }
.admin-sair { display: block; margin: 12px auto 0; }

.admin-relatorio { margin-top: 14px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.relatorio-loja { border: 1px solid var(--linha); border-radius: 12px; padding: 10px 12px; background: var(--superficie-2); }
.relatorio-topo { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.relatorio-topo strong { font-size: 15px; }
.relatorio-topo span, .relatorio-totais { font-size: 12.5px; color: var(--suave); }
.relatorio-totais { margin: 2px 0 6px; }
.mudancas { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: 13.5px; }
.mudanca { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.mudanca-ic { flex: none; width: 18px; text-align: center; font-weight: 800; }
.mudanca-nome { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mudanca-valor { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.mudanca.sobe .mudanca-ic, .mudanca.novo .mudanca-ic { color: var(--verde); }
.mudanca.desce .mudanca-ic, .mudanca.saiu .mudanca-ic { color: var(--st-cancelado); }
.mudanca.preco .mudanca-ic { color: var(--ambar); font-size: 11px; }
.revisar { margin: 8px 0 0; padding-top: 6px; border-top: 1px dashed var(--linha); font-size: 12.5px; }
.revisar strong { display: block; color: var(--ambar); }
.revisar ul { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 2px; }
.revisar .sistema { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--suave); }
.relatorio-nada { margin: 0; font-size: 13.5px; color: var(--suave); }
.relatorio-alerta { margin: 8px 0 0; font-size: 13px; font-weight: 700; color: var(--st-cancelado); }
.relatorio-resultado { margin: 0; font-size: 14.5px; font-weight: 800; color: var(--verde); }

/* ---------- administrador: é o mesmo produto nas duas lojas? ---------- */

.admin-iguais { width: 100%; margin-top: 12px; }
.modal-caixa.iguais { max-width: 520px; text-align: left; display: grid; gap: 10px; }
.iguais h2 { text-align: center; }
.iguais h2:focus { outline: none; }
.iguais-aviso:empty { display: none; }
.iguais-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.igual { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--linha); border-radius: 12px; background: var(--superficie-2); }
.igual-lado { display: grid; gap: 1px; min-width: 0; line-height: 1.3; }
.igual-lado + .igual-lado { padding-top: 8px; border-top: 1px dashed var(--linha); }
.igual-loja { font-size: 11.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--suave); }
.igual-nome { font-size: 15px; }
.igual-sistema { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; text-transform: uppercase; color: var(--suave); overflow-wrap: anywhere; }
.igual-preco { font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.igual-variacao { font-weight: 500; color: var(--suave); }
.igual-acoes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.iguais .igual-acoes button { min-height: 44px; margin: 0; font-size: 15px; }
.iguais .igual-acoes button:disabled { opacity: .6; cursor: default; }
.iguais .botao-principal#iguais-publicar { margin-top: 2px; }
.iguais .link { justify-self: center; }

/* ---------- administrador: imposto de saída e sobra ---------- */

.admin-imposto { margin-bottom: 12px; }
.detalhes dd.negativo { color: var(--st-cancelado); }

/* ---------- vendas do mês (aba Anunciados) ---------- */

.painel-vendas {
  display: flex; align-items: center; gap: 6px; margin: 0 0 10px; padding: 6px;
  border: 1px solid var(--linha); border-radius: 12px; background: var(--superficie); box-shadow: var(--sombra);
}
.vendas-resumo { flex: 1; min-width: 0; text-align: center; line-height: 1.3; }
.vendas-resumo strong { display: block; font-size: 15px; }
.vendas-resumo span { font-size: 13.5px; color: var(--suave); font-variant-numeric: tabular-nums; }
.mes-seta {
  flex: none; width: 38px; height: 38px; display: grid; place-items: center; cursor: pointer;
  border: 0; border-radius: 10px; background: var(--superficie-2); color: var(--texto);
}
.mes-seta:disabled { opacity: .35; cursor: default; }
html.ocultar-contas .vendas-comissao { display: none; }

.botao-comprovante {
  display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 40px; margin-top: 8px;
  border: 1.5px solid var(--st-vendido); border-radius: 10px; background: var(--st-vendido-fundo); color: var(--st-vendido);
  font-weight: 800; font-size: 14px; cursor: pointer;
}
.botao-comprovante .ic { width: 19px; height: 19px; }

/* ---------- venda: dados do cliente ---------- */

.modal-caixa.venda {
  max-width: 460px; text-align: left;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
}
.modal-caixa.venda h2 { grid-column: 1 / -1; font-size: 20px; }
.venda-produto { grid-column: 1 / -1; margin: -6px 0 2px; font-size: 14.5px; font-weight: 700; color: var(--suave); white-space: pre-line; }
/* nome do cliente: clientes já cadastrados (de todos os vendedores) aparecem enquanto digita */
.venda-cliente { position: relative; }
.sugestoes {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 5; margin: 4px 0 0; padding: 4px; list-style: none;
  border: 1.5px solid var(--linha); border-radius: 12px; background: var(--superficie); box-shadow: 0 10px 28px rgba(0, 0, 0, .2);
}
.sugestoes li { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--texto); }
.sugestoes li strong { font-size: 15px; font-weight: 700; }
.sugestoes li span { font-size: 12.5px; font-weight: 500; color: var(--suave); }
.sugestoes li[aria-selected="true"] { background: var(--superficie-2); }
@media (hover: hover) { .sugestoes li:hover { background: var(--superficie-2); } }
.venda-campo { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 13px; font-weight: 700; color: var(--suave); }
.venda-campo .campo-texto { height: 44px; font-size: 16px; }
.venda-largo { grid-column: 1 / -1; }
.venda .botao-principal { margin-top: 4px; }
.venda-cancelar { justify-self: center; }
.assinatura-topo { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; font-weight: 700; color: var(--suave); }
.assinatura-topo .link { padding: 0; font-size: 13px; }
#venda-assinatura {
  display: block; width: 100%; height: auto; aspect-ratio: 3 / 1; margin-top: 4px; touch-action: none; cursor: crosshair;
  border: 1.5px dashed var(--linha); border-radius: 12px; background: #fffdf6;
}

/* ---------- comprovante gerado ---------- */

.modal-caixa.comprovante { max-width: 430px; padding: 12px; display: grid; gap: 10px; }
#comprovante-imagem { display: block; width: 100%; height: auto; border-radius: 10px; }
.comprovante .botao-principal { margin: 0; display: flex; align-items: center; justify-content: center; gap: 8px; }
.comprovante-acoes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.comprovante-acoes .botao-secundario { padding: 0 8px; }

/* ---------- primeiro acesso: nome do vendedor ---------- */

.modal {
  position: fixed; inset: 0; z-index: 50; overflow-y: auto;
  display: flex; align-items: flex-start; justify-content: center;
  padding: max(10vh, 20px) 16px 24px;
  background: rgba(18, 16, 12, .55); animation: aparece .2s ease;
}
.modal-caixa {
  width: 100%; max-width: 380px; padding: 22px 18px 16px; border-radius: 18px;
  background: var(--superficie); color: var(--texto); text-align: center;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .3);
}
.modal-caixa .logo { margin: 0 auto 10px; width: 48px; height: 48px; border-radius: 14px; font-size: 26px; }
.modal-caixa h2 { margin: 0; font-size: 22px; font-weight: 800; }
.modal-texto { margin: 4px 0 16px; font-size: 16px; color: var(--suave); }
.modal-caixa .campo-texto { text-align: center; }
.modal-caixa .botao-principal { margin-top: 12px; }
.erro { margin: 8px 0 0; font-size: 14px; font-weight: 700; color: var(--st-cancelado); }

/* ---------- abas (barra inferior) ---------- */

.abas {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  min-height: var(--altura-abas);
  padding: 5px var(--lateral-dir) calc(5px + env(safe-area-inset-bottom)) var(--lateral);
  background: var(--superficie); border-top: 1px solid var(--linha);
  box-shadow: 0 -2px 12px rgba(29, 27, 22, .07);
}
body.digitando .abas { display: none; }

.aba {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: 50px; border-radius: 12px; color: var(--suave); text-decoration: none;
  font-size: 13px; font-weight: 700;
}
.aba .ic { width: 24px; height: 24px; }
.aba[aria-current="page"], .lojas .aba[aria-pressed="true"] { color: var(--tinta); background: var(--amarelo); }

.contador {
  position: absolute; top: 2px; left: calc(50% + 7px);
  min-width: 21px; height: 21px; padding: 0 6px; border-radius: 999px;
  display: grid; place-items: center;
  background: #c62828; color: #fff; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums;
  border: 2px solid var(--superficie);
}

/* ---------- aviso flutuante (toast) ---------- */

.toast {
  position: fixed; left: 50%; bottom: calc(var(--altura-abas) + 12px + env(safe-area-inset-bottom)); z-index: 30;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  width: max-content; max-width: min(460px, calc(100vw - 24px));
  padding: 8px 8px 8px 16px; border-radius: 14px;
  background: #1d1b16; color: #fff; box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
  font-size: 15px; font-weight: 600;
}
.toast button {
  flex: none; min-height: 38px; padding: 0 14px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--amarelo); color: var(--tinta); font-weight: 800;
}
body.digitando .toast { bottom: 12px; }

/* ---------- rodapé e estados ---------- */

.mais {
  display: block; width: 100%; min-height: 48px; margin: 14px 0 0; border-radius: 12px; cursor: pointer;
  border: 1.5px solid var(--linha); background: var(--superficie); font-weight: 700; font-size: 16px;
}

.vazio { text-align: center; padding: 28px 8px; color: var(--suave); }
.vazio-titulo { margin: 0 0 6px; font-size: 18px; font-weight: 700; color: var(--texto); }
.vazio p { margin: 0 auto; max-width: 30em; }


/* ---------- telas pequenas e grandes ---------- */

@media (max-width: 359px) {
  .lojas { gap: 4px; padding: 4px; }
  .lojas .aba { font-size: 12px; padding-left: 1px; padding-right: 1px; }
  .botao-buscar { padding: 0 10px; }
  .ordens { gap: 4px; }
  .ordem { gap: 3px; padding: 0 5px; font-size: 13px; }
  .ordem .ic { width: 15px; height: 15px; }
  .status-opcao { font-size: 11.5px; }
}

/* telas estreitas: os 4 botões do cartão continuam na linha do preço */
@media (max-width: 374px) {
  :root { --altura-botao: 35px; }
}

@media (min-width: 720px) {
  .titulo h1 { font-size: 20px; }
  .lojas { max-width: 480px; margin-left: max(0px, calc((100% - 1080px) / 2)); }
  .ordens { justify-content: flex-start; }
  .ordem { flex: 0 1 190px; }
  .atalhos { flex-wrap: wrap; overflow: visible; margin-left: auto; margin-right: auto; padding-left: 0; padding-right: 0; }
  .lista { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .abas {
    left: 50%; right: auto; bottom: 12px; transform: translateX(-50%);
    width: 380px; border: 1px solid var(--linha); border-radius: 18px; padding-bottom: 5px;
    box-shadow: 0 8px 28px rgba(29, 27, 22, .16);
  }
  body { padding-bottom: calc(var(--altura-abas) + 32px); }
  .toast { bottom: calc(var(--altura-abas) + 28px); }
}

@media (min-width: 1080px) {
  .lista { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Mini galeria de fotos no fim dos detalhes */
.detalhes .galeria { grid-column: 1 / -1; display: grid; gap: 6px; margin-top: 6px; }
.galeria dd { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.miniatura {
  padding: 0; border: 1px solid var(--linha); border-radius: 6px; overflow: hidden;
  background: #fff; aspect-ratio: 1; cursor: zoom-in;
}
.miniatura img { width: 100%; height: 100%; object-fit: cover; display: block; }
.miniatura:focus-visible { outline: 2px solid var(--foco); outline-offset: 2px; }

/* Tela cheia das fotos */
body.visor-aberto { overflow: hidden; }
.visor {
  position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, .92);
  display: flex; align-items: center; justify-content: center;
  padding: 56px 12px; touch-action: pan-y;
}
.visor[hidden] { display: none; }
.visor-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; background: #fff; user-select: none; }
.visor button {
  position: absolute; z-index: 1; color: #fff; background: rgba(20, 20, 20, .8);
  border: 2px solid rgba(255, 255, 255, .9); box-shadow: 0 2px 10px rgba(0, 0, 0, .5);
  width: 48px; height: 48px; border-radius: 50%; font-size: 30px; line-height: 1; cursor: pointer;
}
/* Ao passar o mouse ou tocar, escurece (nunca clareia): as fotos quase sempre têm fundo branco
   e, no celular, o "hover" fica grudado no botão depois do toque. */
@media (hover: hover) { .visor button:hover { background: rgba(0, 0, 0, .92); } }
.visor button:active { background: #000; }
.visor button:focus-visible { outline: 3px solid var(--amarelo); outline-offset: 2px; }
.visor-fechar { top: max(10px, env(safe-area-inset-top)); right: 10px; }
.visor-seta { top: 50%; transform: translateY(-50%); }
.visor-seta.anterior { left: 8px; }
.visor-seta.proxima { right: 8px; }
.visor-seta[hidden] { display: none; }
.visor-contador { position: absolute; bottom: max(14px, env(safe-area-inset-bottom)); margin: 0; color: #fff; font-size: 14px; font-weight: 600; }

/* ---------- administrador: relatório de vendas (página própria, por cima da gaveta) ---------- */

.admin-vendas { width: 100%; margin-top: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.admin-vendas .ic { width: 20px; height: 20px; }

.rv {
  position: fixed; inset: 0; z-index: 55; overflow-y: auto; overscroll-behavior: contain;
  background: var(--fundo); animation: aparece .2s ease;
}
.rv[hidden] { display: none; }
.rv-topo {
  position: sticky; top: 0; z-index: 4; display: flex; align-items: center; gap: 6px;
  padding: max(8px, env(safe-area-inset-top)) var(--lateral-dir) 8px var(--lateral);
  background: var(--superficie); border-bottom: 1px solid var(--linha);
}
.rv-topo h2 { margin: 0; font-size: 18px; font-weight: 800; }
.rv-topo h2:focus { outline: none; }
.rv-voltar {
  flex: none; width: 42px; height: 42px; display: grid; place-items: center; cursor: pointer;
  border: 0; border-radius: 10px; background: transparent; color: var(--texto);
}
.rv-voltar .ic { width: 24px; height: 24px; }
.rv-voltar:active { background: var(--superficie-2); }
.rv-pagina {
  max-width: 760px; margin: 0 auto; display: grid; gap: 14px;
  padding: 14px var(--lateral-dir) max(28px, env(safe-area-inset-bottom)) var(--lateral);
}
.rv-corpo { display: grid; gap: 14px; min-width: 0; transition: opacity .2s ease; }
.rv-corpo.atualizando { opacity: .55; }
.rv-estado {
  margin: 0; padding: 18px 14px; border-radius: 14px; text-align: center;
  background: var(--superficie); border: 1px solid var(--linha); color: var(--suave);
}
.rv-estado .erro { margin: 0 0 10px; }
.rv-nota { margin: 0; font-size: 12.5px; color: var(--suave); }

.rv-filtros { display: grid; gap: 10px; min-width: 0; }
.rv-opcoes { display: flex; flex-wrap: wrap; gap: 6px; }
.rv-opcao {
  min-height: 36px; padding: 0 12px; cursor: pointer; border-radius: 999px;
  border: 1.5px solid var(--linha); background: var(--superficie); color: var(--texto);
  font: inherit; font-size: 14px; font-weight: 700;
}
/* selecionado: escuro no tema claro, amarelo no escuro (como os classificadores) */
.rv-opcao[aria-pressed="true"] { background: var(--tinta); border-color: var(--tinta); color: #fff; }
:root[data-theme="dark"] .rv-opcao[aria-pressed="true"] { background: var(--amarelo); border-color: var(--amarelo); color: var(--tinta); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .rv-opcao[aria-pressed="true"] { background: var(--amarelo); border-color: var(--amarelo); color: var(--tinta); }
}
.rv-periodo { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rv-periodo label { display: grid; gap: 4px; min-width: 0; font-size: 12.5px; font-weight: 700; color: var(--suave); }
.rv-periodo .campo-texto { height: 44px; padding: 0 8px; font-size: 15px; }
.rv-periodo .campo-texto:disabled { opacity: .55; }

.rv-numeros { display: grid; gap: 10px; }
.rv-destaque, .rv-cartao, .rv-pagamento, .rv-grafico, .rv-bloco, .rv-envio {
  border-radius: 14px; background: var(--superficie); border: 1px solid var(--linha);
}
.rv-destaque { padding: 14px 16px; display: grid; gap: 2px; }
.rv-rotulo { font-size: 13px; font-weight: 700; color: var(--suave); }
.rv-valor-grande { font-size: clamp(30px, 9vw, 44px); font-weight: 800; line-height: 1.15; letter-spacing: -.5px; overflow-wrap: anywhere; }
.rv-variacao { font-size: 14px; font-weight: 800; }
.rv-variacao span { font-weight: 600; color: var(--suave); }
.rv-variacao.sobe { color: var(--verde); }
.rv-variacao.desce { color: var(--st-cancelado); }
.rv-cartoes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rv-cartao { padding: 12px 10px; display: grid; gap: 2px; align-content: start; min-width: 0; }
.rv-cartao strong { font-size: clamp(15px, 4.4vw, 19px); font-weight: 800; white-space: nowrap; }
.rv-lucro { padding: 12px 16px; }
.rv-lucro strong { font-size: clamp(22px, 6.5vw, 28px); }
.rv-cartao small { font-size: 12px; color: var(--suave); }
.rv-pagamento { padding: 12px 14px; display: grid; gap: 8px; }
.rv-pagamento-textos { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; font-size: 13.5px; }
.rv-medidor { height: 10px; border-radius: 999px; overflow: hidden; background: color-mix(in srgb, var(--grafico) 24%, var(--superficie)); }
.rv-medidor span { display: block; height: 100%; background: var(--grafico); }

.rv-grafico { margin: 0; padding: 14px 14px 10px; min-width: 0; }
.rv-grafico figcaption { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; }
.rv-grafico figcaption strong { font-size: 15px; }
.rv-grafico figcaption span { font-size: 12.5px; color: var(--suave); }
.rv-plot { position: relative; height: 190px; margin: 26px 0 0 54px; }
.rv-grade { position: absolute; left: 0; right: 0; border-top: 1px solid var(--linha); }
.rv-grade em {
  position: absolute; right: calc(100% + 6px); top: 0; transform: translateY(-50%);
  font-style: normal; font-size: 11px; color: var(--suave); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.rv-barras {
  position: absolute; inset: 0; display: grid; align-items: end; gap: 2px;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
}
.rv-barra {
  position: relative; height: 100%; padding: 0; border: 0; border-radius: 4px; cursor: pointer;
  background: transparent; display: flex; align-items: flex-end; justify-content: center;
}
.rv-barra-cor {
  position: relative; display: block; width: min(24px, 100%); height: var(--altura);
  border-radius: 4px 4px 0 0; background: var(--grafico); transition: filter .15s ease;
}
.rv-barra:hover .rv-barra-cor, .rv-barra:focus-visible .rv-barra-cor { filter: brightness(1.18); }
.rv-barra:focus-visible { outline: 2px solid var(--foco); outline-offset: 1px; }
.rv-barra-valor {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 4px;
  white-space: nowrap; font-size: 11.5px; font-weight: 800; color: var(--texto);
}
.rv-eixo {
  display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 2px; margin: 5px 0 0 54px;
  font-size: 11px; color: var(--suave); text-align: center; font-variant-numeric: tabular-nums;
}
.rv-eixo span { white-space: nowrap; }
.rv-dica {
  position: absolute; top: 0; z-index: 3; transform: translateX(-50%); display: grid; gap: 1px;
  padding: 8px 10px; border-radius: 10px; pointer-events: none; white-space: nowrap;
  background: var(--tinta); color: #fff; box-shadow: 0 6px 24px rgba(0, 0, 0, .25); font-size: 12.5px;
}
.rv-dica strong { font-size: 15px; }
.rv-dica[hidden] { display: none; }
:root[data-theme="dark"] .rv-dica { background: #f3efe6; color: #1d1b16; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .rv-dica { background: #f3efe6; color: #1d1b16; }
}
.rv-tabela { margin-top: 10px; font-size: 13.5px; }
.rv-tabela summary { cursor: pointer; color: var(--suave); font-weight: 700; }
.rv-tabela table { width: 100%; margin-top: 6px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.rv-tabela th, .rv-tabela td { padding: 5px 4px; border-bottom: 1px solid var(--linha); text-align: right; }
.rv-tabela th:first-child { text-align: left; font-weight: 600; }

.rv-bloco { padding: 14px; display: grid; gap: 10px; min-width: 0; }
.rv-bloco-topo { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.rv-bloco h3, .rv-envio h3 { margin: 0; font-size: 16px; font-weight: 800; }
.rv-aviso-estoque {
  margin: 0; display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 10px;
  background: var(--ambar-fundo); color: var(--ambar); font-size: 13.5px; font-weight: 700;
}
.rv-aviso-estoque .ic { flex: none; width: 18px; height: 18px; }
.rv-produtos { list-style: none; margin: 0; padding: 0; display: grid; }
.rv-produto {
  display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 8px; align-items: center;
  padding: 9px 0; border-top: 1px solid var(--linha);
}
.rv-produto:first-child { border-top: 0; }
.rv-posicao { font-weight: 800; color: var(--suave); text-align: center; font-variant-numeric: tabular-nums; }
.rv-produto-textos { display: grid; min-width: 0; }
.rv-produto-textos strong {
  font-size: 14.5px; line-height: 1.3; overflow: hidden;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
}
.rv-produto-textos span, .rv-produto-numeros span { font-size: 12.5px; color: var(--suave); }
.rv-produto-numeros { display: grid; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rv-produto-numeros strong { font-size: 14.5px; }
.rv-estoque { font-weight: 700; }
.rv-estoque.tem { color: var(--verde); }
.rv-estoque.sem { color: var(--st-cancelado); }
.rv-ver-mais { justify-self: center; }

.rv-notas { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rv-nota-venda { padding: 10px 12px; border-radius: 12px; background: var(--superficie-2); }
.rv-nota-topo { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; color: var(--suave); }
.rv-nota-topo strong { color: var(--texto); font-size: 14.5px; font-variant-numeric: tabular-nums; }
.rv-nota-venda ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 3px; font-size: 14px; }
.rv-nota-venda ul > li { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.rv-nota-venda ul > li span:first-child { min-width: 0; }
.rv-nota-venda ul > li span:last-child { flex: none; font-variant-numeric: tabular-nums; }

.rv-envio { padding: 14px; display: grid; gap: 10px; }
.rv-envio-linha { display: grid; gap: 8px; }
.rv-envio .botao-principal { margin: 0; }
.rv-envio .botao-principal:disabled { opacity: .6; cursor: default; }
.rv-envio .erro { margin: 0; }
.rv-envio-resultado:empty { display: none; }
.rv-envio-resultado ul { margin: 4px 0; padding-left: 18px; font-size: 13.5px; }

@media (min-width: 640px) {
  .rv-envio-linha { grid-template-columns: minmax(0, 200px) minmax(0, 1fr); align-items: center; }
}

/* relatório de vendas: época do ano, dia da semana, categorias e o alerta de reposição do painel */
.rv-frase { margin: 8px 0 0; font-size: 14px; line-height: 1.4; }
.rv-grafico .rv-frase { margin-top: 6px; }
span.rv-barra { cursor: default; }
.rv-bloco h3 { scroll-margin-top: 72px; }
.rv-deitadas { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.rv-deitada {
  display: grid; gap: 5px; width: 100%; padding: 0; border: 0; border-radius: 8px;
  background: none; color: inherit; font: inherit; text-align: left;
}
button.rv-deitada { cursor: pointer; padding: 5px 6px; margin: -5px -6px; width: calc(100% + 12px); }
button.rv-deitada[aria-pressed="true"] { background: var(--ambar-fundo); box-shadow: inset 0 0 0 1.5px var(--ambar-linha); }
button.rv-deitada:focus-visible { outline: 2px solid var(--foco); outline-offset: 1px; }
.rv-deitada-textos { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 14px; }
.rv-deitada-textos span:first-child { font-weight: 700; min-width: 0; }
.rv-deitada-textos span:last-child { flex: none; color: var(--suave); font-variant-numeric: tabular-nums; }
.rv-deitada-trilho {
  display: block; height: 8px; border-radius: 999px; overflow: hidden;
  background: color-mix(in srgb, var(--grafico) 18%, var(--superficie));
}
.rv-deitada-trilho span { display: block; height: 100%; border-radius: 999px; background: var(--grafico); }
.rv-filtro-categoria {
  justify-self: start; display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 8px 0 12px;
  border: 1.5px solid var(--ambar-linha); border-radius: 999px; background: var(--ambar-fundo); color: var(--texto);
  font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.rv-filtro-categoria .ic { width: 16px; height: 16px; color: var(--suave); }

.admin-reposicao {
  margin-top: 12px; padding: 12px; border-radius: 12px;
  border: 1px solid var(--ambar-linha); background: var(--ambar-fundo);
}
.admin-reposicao h4 { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 800; }
.admin-reposicao h4 .ic { width: 18px; height: 18px; color: var(--fogo); }
.reposicao-qtd {
  margin-left: auto; min-width: 24px; padding: 1px 7px; border-radius: 999px; text-align: center;
  background: var(--fogo); color: var(--superficie); font-size: 12.5px; font-weight: 800;
}
.admin-reposicao p { margin: 4px 0 8px; font-size: 13px; color: var(--suave); }
.admin-reposicao ol { margin: 0; padding-left: 22px; display: grid; gap: 7px; font-size: 14px; }
.admin-reposicao li strong { display: block; line-height: 1.3; }
.admin-reposicao li span { display: block; font-size: 12.5px; color: var(--suave); }
.admin-reposicao .link { display: block; margin: 8px auto 0; }

/* ---------- gavetinhas "Ordenar" e "Filtrar" (sobem de baixo; no computador, ficam no meio) ---------- */

.filtro-categoria-icone { display: contents; }
.filtro-categoria-icone .ic { flex: none; width: 20px; height: 20px; color: var(--suave); }

.camada-folha { position: fixed; inset: 0; z-index: 45; background: rgba(18, 16, 12, .45); animation: aparece .2s ease; }
.folha {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 46; margin: 0 auto; width: min(520px, 100%);
  max-height: min(82vh, 680px); overflow-y: auto; overscroll-behavior: contain;
  padding: 0 var(--lateral-dir) max(14px, env(safe-area-inset-bottom)) var(--lateral);
  border-radius: 18px 18px 0 0; background: var(--superficie); box-shadow: 0 -8px 30px rgba(0, 0, 0, .22);
  animation: folha-sobe .22s ease;
}
.folha[hidden], .camada-folha[hidden] { display: none; }
@keyframes folha-sobe { from { transform: translateY(28px); opacity: 0; } to { transform: none; opacity: 1; } }
.folha-topo {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 0 8px; background: var(--superficie);
}
.folha-topo h2 { margin: 0; font-size: 18px; font-weight: 800; }
.folha-lista { display: grid; gap: 2px; padding-bottom: 4px; }
.folha-opcao {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 0 12px; cursor: pointer;
  border: 0; border-radius: 12px; background: transparent; color: var(--texto);
  font: inherit; font-size: 16px; font-weight: 600; text-align: left;
}
.folha-opcao > .ic { flex: none; width: 22px; height: 22px; color: var(--suave); }
.folha-opcao-texto { flex: 1; min-width: 0; }
.folha-opcao-qtd { flex: none; color: var(--suave); font-weight: 500; font-variant-numeric: tabular-nums; }
.folha-opcao > .ic:last-child { width: 20px; height: 20px; stroke-width: 2.6; color: var(--verde); visibility: hidden; }
.folha-opcao[aria-checked="true"] { background: var(--superficie-2); font-weight: 800; }
.folha-opcao[aria-checked="true"] > .ic:last-child { visibility: visible; }
.folha-opcao:active { background: var(--superficie-2); }
.folha-opcao:focus-visible { outline: 2px solid var(--foco); outline-offset: -2px; }
.folha-separador {
  margin: 10px 12px 4px; font-size: 12.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--suave);
}

@media (min-width: 720px) {
  .folha { top: 50%; bottom: auto; transform: translateY(-50%); border-radius: 18px; animation: aparece .2s ease; }
}
