:root {
  --fundo: #f7f2ec;
  --cartao: #ffffff;
  --campo: #fffdfb;
  --texto: #2e2621;
  --suave: #7d6e64;
  --linha: #e8ddd3;
  --primaria: #a8573c;
  --primaria-escura: #8a4430;
  --primaria-clara: #f3e1d8;
  --acento: var(--primaria);
  --verde: #3f7d58;
  --verde-claro: #e2f0e7;
  --perigo: #b3372f;
  --perigo-fundo: #fbe4e1;
  --topo-fundo: transparent;
  --topo-texto: var(--texto);
  --topo-suave: var(--suave);
  --barra: var(--cartao);
  --barra-texto: var(--suave);
  --barra-ativa: var(--primaria-clara);
  --barra-ativa-texto: var(--primaria);
  --raio: 14px;
  --sombra: 0 1px 3px rgba(60, 40, 30, .08), 0 4px 14px rgba(60, 40, 30, .06);
}

/* ===== Tamanho do texto ===== */
html { font-size: 16px; }
html[data-texto="pequeno"] { font-size: 14px; }
html[data-texto="grande"] { font-size: 18.5px; }

/* ===== Temas de cor (modo claro) ===== */
html[data-cor="marinho"] {
  --fundo: #eef2f8; --linha: #d9e1ee; --campo: #fbfcfe; --texto: #1d2635; --suave: #66738a;
  --primaria: #1f3a68; --primaria-escura: #152a4d; --primaria-clara: #dde6f4;
}
html[data-cor="verde"] {
  --fundo: #eef5f0; --linha: #d6e6db; --campo: #fbfdfb; --texto: #1f2b24; --suave: #637569;
  --primaria: #2f6b4f; --primaria-escura: #22513b; --primaria-clara: #dcece2;
}
html[data-cor="branco"] {
  --fundo: #ffffff; --cartao: #ffffff; --linha: #e4e7ec; --campo: #ffffff; --texto: #1d2433; --suave: #6b7383;
  --primaria: #1b2f55; --primaria-escura: #12223f; --primaria-clara: #e7ecf5;
  --sombra: 0 0 0 1px #e4e7ec, 0 2px 8px rgba(20, 30, 50, .05);
  --topo-fundo: #1b2f55; --topo-texto: #ffffff; --topo-suave: #b9c4da;
  --barra: #1b2f55; --barra-texto: #b9c4da; --barra-ativa: rgba(255, 255, 255, .14); --barra-ativa-texto: #ffffff;
}

/* ===== Modo escuro (vale para qualquer cor) ===== */
html[data-modo="escuro"] {
  --fundo: #121417; --cartao: #1c1f24; --campo: #23272d; --texto: #ecedef; --suave: #a2a8b2; --linha: #30353d;
  --primaria-clara: color-mix(in srgb, var(--primaria) 30%, #1c1f24);
  --primaria-escura: color-mix(in srgb, var(--primaria) 30%, #ffffff);
  --acento: color-mix(in srgb, var(--primaria) 45%, #ffffff);
  --verde: #5fae80; --verde-claro: #1f3328; --perigo: #ef7d74; --perigo-fundo: #3a2220;
  --sombra: 0 1px 3px rgba(0, 0, 0, .4);
  --barra-ativa-texto: var(--acento);
  color-scheme: dark;
}
html[data-modo="escuro"][data-cor="marinho"] { --primaria: #3d63a8; }
html[data-modo="escuro"][data-cor="verde"] { --primaria: #3f8a66; }
html[data-modo="escuro"][data-cor="branco"] {
  --primaria: #3d63a8; --topo-fundo: #1b2f55; --barra: #1b2f55; --barra-ativa-texto: #ffffff; --topo-suave: #b9c4da; --barra-texto: #b9c4da;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--fundo);
  color: var(--texto);
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { margin: 0; }
.oculto { display: none !important; }
.sub { color: var(--suave); font-size: .85rem; margin: 2px 0 0; }

/* ===== Carregando / Login ===== */
.tela-centro { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.spinner { width: 36px; height: 36px; border: 4px solid var(--primaria-clara); border-top-color: var(--primaria); border-radius: 50%; animation: gira 1s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }

.login-card { width: 100%; max-width: 380px; background: var(--cartao); border-radius: 20px; padding: 28px 22px; box-shadow: var(--sombra); text-align: center; }
.login-card .logo { font-size: 2.6rem; }
.login-card h1 { font-size: 1.6rem; margin-top: 4px; }
.login-card form { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.msg { min-height: 1.2em; font-size: .85rem; color: var(--perigo); margin: 4px 0 0; text-align: center; }
.msg.ok { color: var(--verde); }

/* ===== Formulários ===== */
label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; font-weight: 600; color: var(--suave); flex: 1; min-width: 0; }
input, select, textarea {
  font: inherit; font-size: 1rem; font-weight: 400; color: var(--texto);
  border: 1px solid var(--linha); border-radius: 10px; padding: 10px 12px; background: var(--campo); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primaria-clara); border-color: var(--primaria); }
textarea { resize: vertical; }
.linha { display: flex; gap: 10px; }

.btn { font: inherit; font-weight: 600; font-size: .95rem; border: 0; border-radius: 10px; padding: 11px 16px; cursor: pointer; }
.btn.cheio { width: 100%; }
.btn.pequeno { padding: 7px 12px; font-size: .85rem; }
.btn.primario { background: var(--primaria); color: #fff; }
.btn.primario:active { background: var(--primaria-escura); }
.btn.secundario { background: var(--primaria-clara); color: var(--primaria-escura); }
.btn.perigo { background: var(--perigo-fundo); color: var(--perigo); }
.btn.texto { background: none; color: var(--acento); padding-left: 6px; padding-right: 6px; }
.btn:disabled { opacity: .6; }
.link { background: none; border: 0; color: var(--acento); font: inherit; font-size: .85rem; cursor: pointer; padding: 4px; align-self: center; }

/* ===== App ===== */
#app { max-width: 760px; margin: 0 auto; padding-bottom: 150px; }
.topo { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: calc(18px + env(safe-area-inset-top)) 16px 14px; background: var(--topo-fundo); color: var(--topo-texto); margin-bottom: 8px; }
.topo .sub { color: var(--topo-suave); }
.topo h1 { font-size: 1.45rem; }

.resumo { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 0 16px; }
.resumo .bloco { background: var(--cartao); border-radius: 12px; padding: 10px 12px; box-shadow: var(--sombra); }
.resumo .bloco small { display: block; color: var(--suave); font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; }
.resumo .bloco strong { font-size: 1.05rem; white-space: nowrap; }
@media (min-width: 600px) { .resumo { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); } }
.resumo .bloco.destaque { background: var(--primaria); color: #fff; }
.resumo .bloco.destaque small { color: rgba(255,255,255,.78); }
.resumo .bloco.verde strong { color: var(--verde); }

.filtros { padding: 12px 16px 4px; }
.busca-linha { display: flex; gap: 8px; }
.busca-linha input { flex: 1; }
.btn-filtro { position: relative; white-space: nowrap; }
.btn-filtro .contador { background: var(--primaria); color: #fff; border-radius: 99px; font-size: .7rem; padding: 1px 6px; margin-left: 4px; }
.painel-filtros { background: var(--cartao); border-radius: var(--raio); padding: 12px; margin-top: 8px; display: grid; gap: 10px; box-shadow: var(--sombra); }
.painel-filtros .limpar { justify-self: end; }
.info-filtro { font-size: .8rem; color: var(--suave); margin: 8px 2px 0; }

.lista { padding: 8px 16px; display: flex; flex-direction: column; gap: 10px; }
.vazio { text-align: center; color: var(--suave); padding: 40px 10px; }
.vazio div { font-size: 2.4rem; }

.card { display: flex; gap: 12px; background: var(--cartao); border-radius: var(--raio); padding: 10px; box-shadow: var(--sombra); cursor: pointer; align-items: center; }
.card:active { transform: scale(.99); }
.thumb { width: 64px; height: 64px; flex: none; border-radius: 10px; background: var(--primaria-clara); display: flex; align-items: center; justify-content: center; font-size: 1.8rem; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .info { flex: 1; min-width: 0; }
.card h3 { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .meta { font-size: .78rem; color: var(--suave); margin: 3px 0 0; }
.card .obs { font-size: .8rem; margin: 3px 0 0; color: var(--texto); opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag { display: inline-block; background: var(--primaria-clara); color: var(--primaria-escura); border-radius: 99px; padding: 1px 8px; font-size: .72rem; font-weight: 600; margin-right: 4px; }
.card .lado { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.card .valor { font-weight: 700; white-space: nowrap; }
.card .acoes-card { display: flex; gap: 6px; }
.mini { font: inherit; font-size: .78rem; font-weight: 600; border: 0; border-radius: 8px; padding: 6px 9px; cursor: pointer; text-decoration: none; }
.mini.link-loja { background: var(--primaria); color: #fff; display: inline-flex; align-items: center; gap: 4px; }
.mini.comprei { background: var(--verde); color: #fff; }

/* Cashback */
.secao-titulo { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--suave); margin: 10px 2px 0; }
.tabela-lojas { background: var(--cartao); border-radius: var(--raio); box-shadow: var(--sombra); overflow: hidden; }
.tabela-lojas table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.tabela-lojas th, .tabela-lojas td { white-space: nowrap; padding: 9px 8px; text-align: right; border-bottom: 1px solid var(--linha); }
.tabela-lojas th:first-child, .tabela-lojas td:first-child { text-align: left; white-space: normal; }
.tabela-lojas { overflow-x: auto; }
.tabela-lojas th { background: var(--fundo); color: var(--suave); font-size: .72rem; text-transform: uppercase; }
.tabela-lojas tr:last-child td { border-bottom: 0; }
.tabela-lojas tfoot td { font-weight: 700; background: var(--fundo); }
.tabela-lojas .neg { color: var(--verde); }
.card.cash .thumb { background: var(--verde-claro); }
.card.cash .valor { color: var(--verde); }

/* FAB + abas */
.fab { position: fixed; right: max(18px, calc(50vw - 362px)); bottom: 88px; width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--primaria); color: #fff; font-size: 2rem; line-height: 1; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); cursor: pointer; z-index: 5; }
.abas { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--barra); border-top: 1px solid var(--linha); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); z-index: 6; }
.abas button { flex: 1; background: none; border: 0; font: inherit; font-size: .75rem; color: var(--barra-texto); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border-radius: 10px; cursor: pointer; }
.abas button span { font-size: 1.3rem; }
.abas .marca { display: none; }
.abas button.ativa { color: var(--barra-ativa-texto); font-weight: 700; background: var(--barra-ativa); }

/* Modais */
.modal { border: 0; border-radius: 20px; padding: 0; width: min(520px, calc(100vw - 20px)); max-height: calc(100vh - 30px); background: var(--fundo); color: var(--texto); }
.modal::backdrop { background: rgba(40, 25, 18, .45); }
.modal form { padding: 20px 18px; display: flex; flex-direction: column; gap: 10px; }
.modal h2 { font-size: 1.2rem; }
.acoes { display: flex; gap: 12px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.acoes.principais { margin-top: 12px; }
.acoes.principais .btn { flex: 1; min-height: 48px; }
.acoes-extras { display: none; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; padding-top: 14px; border-top: 1px solid var(--linha); flex-wrap: wrap; }
.acoes-extras.visivel { display: flex; }
.acoes-extras .btn { min-height: 44px; }
.espaco { flex: 1; }

.foto-preview { flex: none; position: relative; min-height: 150px; border: 2px dashed var(--linha); border-radius: var(--raio); background: var(--campo); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.foto-preview.com-foto { border-style: solid; background: var(--cartao); padding: 0; }
/* Foto inteira, sem cortar */
.foto-preview img { display: block; width: 100%; height: auto; max-height: 55vh; object-fit: contain; cursor: zoom-in; }
.dica-ampliar { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.55); color: #fff; font-size: .72rem; padding: 4px 8px; border-radius: 99px; cursor: zoom-in; }
.foto-vazia { flex: 1; align-self: stretch; min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 2rem; font-weight: 400; color: var(--suave); cursor: pointer; }
.foto-vazia small { font-size: .8rem; }

/* Visualizador em tela cheia */
.visualizador { border: 0; padding: 0; margin: 0; width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; background: rgba(0,0,0,.94); }
.visualizador[open] { display: flex; align-items: center; justify-content: center; }
.visualizador::backdrop { background: #000; }
.visualizador img { max-width: 100%; max-height: 100%; object-fit: contain; }
.fechar-visualizador { position: fixed; top: calc(14px + env(safe-area-inset-top)); right: 14px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.18); color: #fff; font-size: 1.2rem; cursor: pointer; }

.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%) translateY(20px); background: #2b2b2e; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: .9rem; opacity: 0; pointer-events: none; transition: .25s; z-index: 50; max-width: 90vw; text-align: center; }
.toast.mostrar { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Perfil ===== */
.avatar { width: 42px; height: 42px; flex: none; border-radius: 50%; border: 2px solid var(--primaria-clara); background: var(--primaria); color: #fff; font: inherit; font-weight: 700; font-size: 1.1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; }
html[data-cor="branco"] .avatar { background: #fff; color: #1b2f55; border-color: rgba(255,255,255,.4); }
.avatar.grande { width: 52px; height: 52px; font-size: 1.3rem; cursor: default; }
.perfil-topo { display: flex; gap: 12px; align-items: center; margin-bottom: 4px; }
.rotulo { font-size: .8rem; font-weight: 700; color: var(--suave); margin: 8px 0 0; text-transform: uppercase; letter-spacing: .04em; }
.segmentos { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; background: var(--cartao); padding: 5px; border-radius: 12px; box-shadow: var(--sombra); }
.segmentos button { font: inherit; font-weight: 600; border: 0; border-radius: 9px; padding: 10px 6px; background: none; color: var(--texto); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.segmentos button small { font-size: .72rem; font-weight: 500; color: var(--suave); }
.segmentos button.ativo { background: var(--primaria); color: #fff; }
.segmentos button.ativo small { color: rgba(255,255,255,.8); }
.temas { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.temas button { font: inherit; font-size: .85rem; font-weight: 600; color: var(--texto); background: var(--cartao); border: 2px solid transparent; border-radius: 12px; padding: 10px; display: flex; align-items: center; gap: 10px; cursor: pointer; box-shadow: var(--sombra); text-align: left; }
.temas button.ativo { border-color: var(--primaria); }
.amostra { width: 30px; height: 30px; border-radius: 50%; flex: none; position: relative; overflow: hidden; border: 1px solid rgba(0,0,0,.12); }
.amostra i { position: absolute; inset: 50% 0 0 0; }

/* ===== Campo de loja (lista + digitação) ===== */
.combo { position: relative; }
.combo input { padding-right: 38px; }
.combo-seta { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: 0; font-size: .9rem; color: var(--suave); padding: 8px; cursor: pointer; }
.combo-lista { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--cartao); border: 1px solid var(--linha); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.18); max-height: 210px; overflow-y: auto; z-index: 30; margin: 0; padding: 4px; list-style: none; }
.combo-lista li { padding: 10px 10px; border-radius: 8px; font-size: .95rem; font-weight: 400; color: var(--texto); cursor: pointer; }
.combo-lista li:hover, .combo-lista li.foco { background: var(--primaria-clara); }
.combo-lista li.nova { color: var(--acento); font-weight: 600; }
.combo-lista li.vazio-combo { color: var(--suave); cursor: default; background: none; }

/* Arquivo de foto acessível (sem display:none, para funcionar em todos os celulares) */
.input-arquivo { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
.fotos-botoes { display: flex; gap: 8px; justify-content: center; }
.fotos-botoes label { flex: none; display: inline-flex; flex-direction: row; font-size: .85rem; font-weight: 600; color: var(--primaria-escura); background: var(--primaria-clara); border-radius: 10px; padding: 8px 12px; cursor: pointer; }

/* ===== Layout adaptável ===== */
.lista > .secao-titulo, .lista > .tabela-lojas, .lista > .vazio, .lista > .info-filtro { grid-column: 1 / -1; }

/* Tablet */
@media (min-width: 640px) {
  #app { max-width: 980px; }
  .lista { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .abas { justify-content: center; }
  .abas button { flex: 0 1 180px; }
  .modal { width: min(560px, calc(100vw - 40px)); }
}

/* Computador: menu lateral */
@media (min-width: 1000px) {
  body { padding-left: 230px; }
  #app { max-width: 1240px; padding: 0 20px 100px; }
  .topo { margin: 0 -20px 8px; padding: 26px 36px 18px; }
  .topo h1 { font-size: 1.8rem; }
  .resumo { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lista { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
  .painel-filtros { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; }
  .painel-filtros .limpar { grid-column: 1 / -1; }
  .abas { top: 0; right: auto; width: 230px; flex-direction: column; justify-content: flex-start; gap: 4px; padding: 22px 12px; border-top: 0; border-right: 1px solid var(--linha); }
  .abas .marca { display: block; font-size: 1.1rem; font-weight: 800; color: var(--barra-ativa-texto); padding: 4px 12px 18px; }
  html[data-cor="branco"] .abas .marca { color: #fff; }
  .abas button { flex: none; flex-direction: row; justify-content: flex-start; gap: 10px; font-size: .95rem; padding: 11px 12px; }
  .abas button span { font-size: 1.15rem; }
  .fab { right: 36px; bottom: 36px; }
  .toast { bottom: 40px; }
  .card:hover { box-shadow: 0 0 0 2px var(--primaria-clara), var(--sombra); }
}

/* ===== Cashback por produto ===== */
.segmentos.visao { margin: 4px 0 2px; grid-column: 1 / -1; }
.cash-item { font-size: .72rem; font-weight: 600; color: var(--verde); white-space: nowrap; }
.tabela-prod { grid-column: 1 / -1; background: var(--cartao); border-radius: var(--raio); box-shadow: var(--sombra); overflow: hidden; }
.cab-prod { display: flex; justify-content: space-between; padding: 8px 12px; background: var(--fundo); color: var(--suave); font-size: .72rem; font-weight: 700; text-transform: uppercase; }
.linha-prod { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--linha); cursor: pointer; }
.linha-prod .thumb { width: 42px; height: 42px; font-size: 1.2rem; border-radius: 8px; }
.linha-prod .info { flex: 1; min-width: 0; }
.linha-prod h3 { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.linha-prod .meta { font-size: .75rem; color: var(--suave); margin: 2px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.linha-prod .nums { display: flex; flex-direction: column; align-items: flex-end; font-size: .8rem; white-space: nowrap; }
.linha-prod .nums .neg { color: var(--verde); }
.linha-prod.geral, .linha-prod.total { cursor: default; background: var(--fundo); }
.linha-prod.total h3 { font-size: .95rem; }
@media (min-width: 640px) {
  .linha-prod .nums { flex-direction: row; gap: 18px; }
  .linha-prod .nums > * { min-width: 92px; text-align: right; }
}

/* ===== Dados da conta ===== */
.info-conta { background: var(--cartao); border-radius: 12px; box-shadow: var(--sombra); overflow: hidden; }
.info-conta div { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--linha); font-size: .88rem; }
.info-conta div:first-child { border-top: 0; }
.info-conta span { color: var(--suave); }
.info-conta b { font-weight: 600; text-align: right; word-break: break-all; }
.info-conta .link { padding: 0; }

/* ===== Quantidade, preço web e relatórios ===== */
label.estreito { flex: 0 0 34%; }
.total-item { margin: -4px 2px 0; font-size: .82rem; font-weight: 600; color: var(--acento); min-height: 0; }
.total-item:empty { display: none; }
.qtd-item { font-size: .72rem; color: var(--suave); white-space: nowrap; }
.resumo .bloco .un { font-size: .72rem; font-weight: 500; color: var(--suave); }
.tabela-lojas td small { display: block; font-weight: 500; }
.tabela-lojas .nome-grupo { display: block; }
.tabela-lojas .falta { color: var(--acento); font-size: .72rem; margin-top: 2px; }
.linha-prod .nums .sub { margin: 0; font-size: .78rem; }
.segmentos.visao { grid-auto-columns: 1fr; }
.segmentos.visao button { font-size: .8rem; padding: 9px 4px; }

.tabela-lojas td:first-child { min-width: 92px; }
@media (max-width: 420px) {
  .tabela-lojas table { font-size: .78rem; }
  .tabela-lojas th, .tabela-lojas td { padding: 8px 5px; }
  .tabela-lojas th:first-child, .tabela-lojas td:first-child { padding-left: 10px; }
  .tabela-lojas th:last-child, .tabela-lojas td:last-child { padding-right: 10px; }
}


/* ===== Exportar ===== */
.btn-exportar { width: 100%; grid-column: 1 / -1; min-height: 46px; }
.exportar-pronto { background: var(--verde-claro); border-radius: 12px; padding: 12px; margin-top: 6px; }
.exportar-pronto p { margin: 0 0 4px; word-break: break-all; }
.exportar-pronto .acoes { margin-top: 8px; }
.exportar-pronto ~ .acoes .btn[data-fechar] { flex: 1; }

#modal-recuperar .msg { text-align: left; }

/* ===== Seleção múltipla ===== */
.btn-selecionar { padding-left: 13px; padding-right: 13px; font-size: 1.05rem; }
.btn-selecionar.ativo { background: var(--primaria); color: #fff; }
.card .check { width: 26px; height: 26px; flex: none; border-radius: 50%; border: 2px solid var(--linha); background: var(--cartao); display: flex; align-items: center; justify-content: center; font-size: .85rem; font-weight: 800; color: #fff; }
.card.selecionado { box-shadow: 0 0 0 2px var(--primaria), var(--sombra); background: var(--primaria-clara); }
.card.selecionado .check { background: var(--primaria); border-color: var(--primaria); }
body.selecionando .card { user-select: none; -webkit-user-select: none; }
.card { -webkit-touch-callout: none; }
.barra-selecao { position: fixed; left: 12px; right: 12px; bottom: calc(82px + env(safe-area-inset-bottom)); z-index: 8; display: flex; align-items: center; gap: 8px; background: var(--cartao); border-radius: 16px; padding: 10px 12px; box-shadow: 0 8px 28px rgba(0,0,0,.22); }
.barra-selecao #sel-contagem { flex: 1; font-weight: 700; font-size: .9rem; }
.barra-selecao .btn { min-height: 40px; white-space: nowrap; }
.barra-selecao .btn.texto { padding: 6px 8px; }
body.selecionando #app { padding-bottom: 220px; }
@media (min-width: 1000px) {
  .barra-selecao { left: 254px; right: 32px; bottom: 28px; max-width: 760px; margin: 0 auto; }
}

/* ===== Lixeira ===== */
.modal h2:focus { outline: none; }
.btn-lixeira { display: flex; align-items: center; gap: 12px; width: 100%; background: var(--cartao); border: 0; border-radius: 12px; padding: 12px; box-shadow: var(--sombra); font: inherit; color: var(--texto); cursor: pointer; text-align: left; }
.btn-lixeira .ico { font-size: 1.5rem; }
.btn-lixeira .txt { flex: 1; display: flex; flex-direction: column; }
.btn-lixeira .txt small { color: var(--suave); font-size: .75rem; }
.btn-lixeira .qtd { font-size: .8rem; font-weight: 700; color: var(--primaria-escura); background: var(--primaria-clara); border-radius: 99px; padding: 3px 10px; white-space: nowrap; }
.lixeira-topo { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 36px; }
.lixeira-topo .sub { margin: 0; }
.lixeira-lista { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow-y: auto; }
.linha-lixo { display: flex; align-items: center; gap: 10px; background: var(--cartao); border-radius: 12px; padding: 8px 10px; box-shadow: var(--sombra); cursor: pointer; }
.linha-lixo .thumb { width: 44px; height: 44px; font-size: 1.2rem; border-radius: 8px; }
.linha-lixo .info { flex: 1; min-width: 0; }
.linha-lixo h3 { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.linha-lixo .meta { font-size: .72rem; color: var(--suave); margin: 2px 0 0; }
.linha-lixo .valor { font-weight: 700; font-size: .85rem; white-space: nowrap; }
.linha-lixo .check { width: 24px; height: 24px; flex: none; border-radius: 50%; border: 2px solid var(--linha); display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 800; color: #fff; }
.linha-lixo.selecionado { box-shadow: 0 0 0 2px var(--primaria); background: var(--primaria-clara); }
.linha-lixo.selecionado .check { background: var(--primaria); border-color: var(--primaria); }
.btn.perigo-texto { color: var(--perigo); }
#modal-lixeira .acoes.principais .btn { white-space: nowrap; font-size: .9rem; padding-left: 10px; padding-right: 10px; }

/* ===== Alterar e-mail / senha ===== */
.info-conta .valor-conta { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--texto); }
.info-conta .valor-conta b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; word-break: normal; }
.info-conta .valor-conta .link { flex: none; }
label.mostrar-senha { flex-direction: row; align-items: center; gap: 8px; font-weight: 600; }
label.mostrar-senha input { width: auto; }
#modal-email .msg, #modal-senha .msg { text-align: left; }
#btn-esqueci-atual { align-self: flex-start; padding-left: 0; }

/* ===== Lojas ===== */
.linha-loja { display: flex; align-items: center; gap: 10px; background: var(--cartao); border-radius: 12px; padding: 10px 12px; box-shadow: var(--sombra); }
.linha-loja .ico { font-size: 1.3rem; }
.linha-loja .info { flex: 1; min-width: 0; }
.linha-loja h3 { font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.linha-loja .meta { font-size: .75rem; color: var(--suave); margin: 2px 0 0; }
.btn-apagar-loja { flex: none; width: 40px; height: 40px; border-radius: 10px; border: 0; background: var(--perigo-fundo); font-size: 1.05rem; cursor: pointer; }
.btn-apagar-loja.bloqueado { opacity: .35; filter: grayscale(1); }

/* ===== Locais ===== */
.icones-local { display: flex; flex-wrap: wrap; gap: 6px; }
.ico-op { width: 40px; height: 40px; border-radius: 10px; border: 2px solid transparent; background: var(--cartao); box-shadow: var(--sombra); font-size: 1.2rem; cursor: pointer; }
.ico-op.ativo { border-color: var(--primaria); background: var(--primaria-clara); }

.aviso-banco { margin: 0 16px 10px; padding: 10px 12px; border-radius: 12px; background: var(--perigo-fundo); color: var(--perigo); font-size: .85rem; font-weight: 600; }
dialog .toast { position: fixed; }

/* ===== Título completo (sem cortar) ===== */
.card h3, .linha-prod h3, .linha-lixo h3 { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; line-height: 1.25; }
.card .obs { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* ===== Detalhes do produto ===== */
.detalhe-topo { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.btn-lapis { width: 46px; height: 46px; flex: none; border-radius: 50%; border: 0; background: var(--primaria); font-size: 1.2rem; cursor: pointer; box-shadow: var(--sombra); }
.detalhe-foto { min-height: 120px; }
.detalhe-foto.com-foto img { cursor: zoom-in; }
.detalhe-sem-foto { font-size: 3.4rem; padding: 18px; }
.detalhe-nome { font-size: 1.25rem; line-height: 1.3; overflow-wrap: anywhere; }
.detalhe-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.detalhe-tags .tag { margin: 0; }
.detalhe-info b { word-break: normal; }
.detalhe-info .verde { color: var(--verde); }
.detalhe-obs { margin: 4px 0 0; background: var(--cartao); border-radius: 12px; padding: 10px 12px; box-shadow: var(--sombra); white-space: pre-wrap; overflow-wrap: anywhere; }
.detalhe-botoes { display: flex; gap: 10px; flex-wrap: wrap; }
.detalhe-botoes .btn { flex: 1; text-align: center; text-decoration: none; min-height: 46px; display: inline-flex; align-items: center; justify-content: center; }
.detalhe-botoes .btn[hidden] { display: none; }
.detalhe-foto.com-foto img { max-height: 42vh; }

/* ===== Editar loja / local ===== */
.btn-editar-cat { flex: none; width: 40px; height: 40px; border-radius: 10px; border: 0; background: var(--primaria-clara); font-size: 1rem; cursor: pointer; }
.ico-site { width: 1.15em; height: 1.15em; border-radius: 4px; vertical-align: -0.18em; object-fit: contain; background: #fff; }
.ico-site.grande { width: 30px; height: 30px; border-radius: 7px; vertical-align: middle; }
.linha-loja .ico .ico-site { width: 28px; height: 28px; border-radius: 7px; }
.combo-lista .ico-li { display: inline-block; width: 1.5em; }
.opcao-site { display: flex; align-items: center; gap: 12px; width: 100%; background: var(--cartao); border: 2px solid transparent; border-radius: 12px; padding: 10px 12px; box-shadow: var(--sombra); font: inherit; color: var(--texto); cursor: pointer; text-align: left; }
.opcao-site.ativo { border-color: var(--primaria); background: var(--primaria-clara); }
.opcao-site .prev { font-size: 1.5rem; width: 34px; text-align: center; }
.opcao-site .txt { display: flex; flex-direction: column; }
.opcao-site .txt small { color: var(--suave); font-size: .75rem; }
.cat-site { display: flex; flex-direction: column; gap: 8px; }
#cat-icones { max-height: 32vh; overflow-y: auto; padding: 2px; }
#local-icones { max-height: 26vh; overflow-y: auto; padding: 2px; }

/* ===== Tela de bloqueio ===== */
.tela-bloqueio { border: 0; padding: 0; margin: 0; width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; background: var(--fundo); color: var(--texto); }
.tela-bloqueio[open] { display: flex; align-items: center; justify-content: center; }
.tela-bloqueio::backdrop { background: var(--fundo); }
.bloq-caixa { width: 100%; max-width: 340px; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 24px; }
.bloq-logo { width: 72px; height: 72px; border-radius: 20px; background: var(--primaria); display: flex; align-items: center; justify-content: center; font-size: 2rem; box-shadow: var(--sombra); }
.bloq-caixa h2 { font-size: 1.4rem; }
.bloq-texto { margin: 0; color: var(--suave); font-size: .92rem; text-align: center; min-height: 2.4em; }
.bloq-texto.erro { color: var(--perigo); font-weight: 600; }
.bloq-pontos { display: flex; gap: 14px; min-height: 18px; }
.bloq-pontos span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--primaria); }
.bloq-pontos span.cheio { background: var(--primaria); }
.bloq-pontos.tremer { animation: tremer .35s; }
@keyframes tremer { 25% { transform: translateX(-8px); } 50% { transform: translateX(8px); } 75% { transform: translateX(-5px); } }
.bloq-teclado { display: grid; grid-template-columns: repeat(3, 72px); gap: 14px 22px; margin-top: 8px; }
.bloq-teclado button { width: 72px; height: 72px; border-radius: 50%; border: 0; background: var(--cartao); color: var(--texto); font: inherit; font-size: 1.7rem; font-weight: 500; box-shadow: var(--sombra); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.bloq-teclado button:active { background: var(--primaria-clara); }
.bloq-teclado .tecla-digital, .bloq-teclado .tecla-apagar { background: none; box-shadow: none; font-size: 1.6rem; }
.bloq-teclado .invisivel { visibility: hidden; }
