/* Painel da loja — quem usa é dono de loja, não desenvolvedor.
   Alvo declarado: funcionar bem no celular, porque muita gente
   vai corrigir preço pelo telefone. */

:root {
  --fundo: #f6f6f4;
  --superficie: #fff;
  --borda: #dcdad4;
  --texto: #1f1d1a;
  --suave: #6d6a63;
  --acento: #2b2011;
  --perigo: #a8362c;
  --ok: #2a7d5f;
  --raio: 10px;
  --sombra: 0 1px 2px rgb(0 0 0 / 6%), 0 4px 14px rgb(0 0 0 / 5%);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--fundo);
  color: var(--texto);
}

h1, h2, h3 { margin: 0 0 .6rem; line-height: 1.25; }
h2 { font-size: 1.05rem; }
h3 { font-size: .95rem; margin-top: 1.4rem; }
code { background: #eceae4; padding: .1em .35em; border-radius: 4px; font-size: .9em; }

/* ------------------------------------------------------------- login */
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.login .cartao { width: min(380px, 100%); }

/* -------------------------------------------------------------- topo */
.topo {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  padding: .7rem 1rem;
  background: var(--superficie);
  border-bottom: 1px solid var(--borda);
}
.topo strong { font-size: 1rem; }
.cresce { flex: 1; }

.estado {
  font-size: .8rem;
  color: var(--suave);
  padding: .15rem .5rem;
  border-radius: 999px;
  background: #eceae4;
  white-space: nowrap;
}
.estado.pendente { background: #fdf1d6; color: #7a5a12; }
.estado.erro { background: #fbe4e2; color: var(--perigo); }

/* -------------------------------------------------------------- abas */
.abas {
  position: sticky;
  top: 52px;
  z-index: 19;
  display: flex;
  gap: .2rem;
  overflow-x: auto;
  padding: 0 .6rem;
  background: var(--superficie);
  border-bottom: 1px solid var(--borda);
  scrollbar-width: thin;
}
.aba {
  flex: 0 0 auto;
  border: 0;
  background: none;
  padding: .75rem .8rem;
  font: inherit;
  font-size: .92rem;
  color: var(--suave);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.aba.ativa { color: var(--texto); border-bottom-color: var(--acento); font-weight: 600; }

/* ------------------------------------------------------------ páginas */
main { padding: 1rem; max-width: 1100px; margin: 0 auto; }
.pagina { display: none; }
.pagina.ativa { display: block; }

.cartao {
  background: var(--superficie);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  padding: 1.1rem;
  margin-bottom: 1rem;
  box-shadow: var(--sombra);
}

.cartoes { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.cartoes .numero { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.cartoes .rotulo { color: var(--suave); font-size: .85rem; }

.duas-colunas { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 700px) { .duas-colunas { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------- campos */
label { display: block; margin-bottom: .8rem; font-size: .88rem; color: var(--suave); }
label.inline { display: flex; align-items: center; gap: .5rem; color: var(--texto); }

input[type=text], input[type=url], input[type=email], input[type=password],
input[type=number], input[type=search], select, textarea {
  display: block;
  width: 100%;
  margin-top: .25rem;
  padding: .55rem .65rem;
  border: 1px solid var(--borda);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-size: .95rem;
  color: var(--texto);
}
label.inline input[type=checkbox] { width: auto; margin: 0; }
textarea { resize: vertical; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .85rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--acento); outline-offset: -1px; }

input.invalido { border-color: var(--perigo); }
.erro-campo { color: var(--perigo); font-size: .8rem; margin: .2rem 0 0; }

fieldset { border: 1px solid var(--borda); border-radius: 8px; padding: .8rem; margin: 0 0 .9rem; }
legend { font-size: .85rem; color: var(--suave); padding: 0 .3rem; }

.ajuda { color: var(--suave); font-size: .85rem; margin: 0 0 .8rem; }
.erro { color: var(--perigo); font-size: .85rem; }

/* ------------------------------------------------------------- botões */
.botao {
  border: 1px solid var(--borda);
  background: var(--superficie);
  color: var(--texto);
  padding: .5rem .85rem;
  border-radius: 8px;
  font: inherit;
  font-size: .9rem;
  cursor: pointer;
  white-space: nowrap;
}
.botao:hover { background: #f1efea; }
.botao.primario { background: var(--acento); border-color: var(--acento); color: #fff; }
.botao.primario:hover { filter: brightness(1.15); }
.botao.perigo { color: var(--perigo); border-color: #e9cdc9; }
.botao.discreto { border-color: transparent; color: var(--suave); }
.botao[disabled] { opacity: .5; cursor: progress; }

.barra { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.barra input[type=search] { width: min(280px, 100%); margin: 0; }
.barra select { width: auto; margin: 0; }

/* -------------------------------------------------------------- lista */
.lista { display: flex; flex-direction: column; gap: .5rem; }

.item {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .6rem .8rem;
  background: var(--superficie);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
}
.item img { width: 52px; height: 66px; object-fit: cover; border-radius: 6px; background: #eceae4; flex: 0 0 auto; }
.item .sem-foto {
  width: 52px; height: 66px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; background: #eceae4;
  color: var(--suave); font-size: .62rem; text-align: center; line-height: 1.2;
}
.item .nome { font-weight: 600; font-size: .93rem; }
.item .meta { color: var(--suave); font-size: .82rem; }
.item.inativo { opacity: .55; }
.item .cresce { min-width: 0; }
.item .nome, .item .meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.etiqueta { font-size: .72rem; padding: .1rem .45rem; border-radius: 999px; background: #eceae4; color: var(--suave); }
.etiqueta.promo { background: #fbe4e2; color: var(--perigo); }
.etiqueta.ok { background: #dff1e9; color: var(--ok); }

/* ------------------------------------------------------------ galeria */
.galeria {
  display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .6rem;
  min-height: 4rem; padding: .4rem; border-radius: 8px;
  border: 2px dashed transparent; transition: border-color .15s, background .15s;
}
/* arquivo vindo de fora: mostra que a galeria aceita o arrasto */
.galeria.recebendo { border-color: var(--acento); background: #f1efea; }
.galeria figure {
  position: relative;
  margin: 0;
  width: 84px;
  cursor: grab;
}
.galeria img { width: 84px; height: 106px; object-fit: cover; border-radius: 6px; border: 1px solid var(--borda); background: #eceae4; }
.galeria figure.arrastando { opacity: .4; }
.galeria .tirar {
  position: absolute; top: 2px; right: 2px;
  border: 0; border-radius: 999px; width: 22px; height: 22px;
  background: rgb(0 0 0 / 60%); color: #fff; cursor: pointer; font-size: 13px; line-height: 1;
}
.galeria figcaption { font-size: .7rem; color: var(--suave); text-align: center; }

.imagem-campo { display: flex; align-items: center; gap: .6rem; margin: .3rem 0 .9rem; flex-wrap: wrap; }
.imagem-campo img { width: 64px; height: 64px; object-fit: contain; background: #eceae4; border-radius: 6px; padding: 4px; }

/* ------------------------------------------------------------- prévia */
.previa { border: 1px solid var(--borda); border-radius: 8px; overflow: hidden; font-size: .8rem; }
.previa__topo { padding: .5rem; text-align: center; font-size: .7rem; letter-spacing: .06em; }
.previa__cabecalho { padding: .9rem; text-align: center; letter-spacing: .18em; font-weight: 600; }
.previa__corpo { padding: 1rem; }
.previa__foto { aspect-ratio: 3/4; border-radius: 4px; margin-bottom: .5rem; }
.previa__titulo { letter-spacing: .04em; font-size: .75rem; }
.previa__preco { margin-top: .2rem; }
.previa__preco s { opacity: .6; }
.previa__selo { display: inline-block; margin-top: .5rem; padding: .1rem .45rem; font-size: .68rem; border-radius: 3px; }
.previa__botao { display: block; width: 100%; margin-top: .9rem; padding: .6rem; border: 0; border-radius: 4px; font: inherit; font-size: .8rem; cursor: default; }

.cor-linha { display: flex; align-items: center; gap: .6rem; margin-bottom: .55rem; }
.cor-linha label { flex: 1; margin: 0; color: var(--texto); font-size: .88rem; }
.cor-linha input[type=color] { width: 42px; height: 32px; padding: 0; border: 1px solid var(--borda); border-radius: 6px; background: none; cursor: pointer; }
.cor-linha input[type=text] { width: 92px; margin: 0; font-family: ui-monospace, monospace; font-size: .82rem; }

/* -------------------------------------------------------------- diálogo */
dialog {
  border: 0;
  border-radius: 12px;
  padding: 0;
  width: min(680px, 96vw);
  max-height: 92dvh;
  box-shadow: 0 20px 60px rgb(0 0 0 / 25%);
}
dialog::backdrop { background: rgb(0 0 0 / 40%); }
dialog form { display: flex; flex-direction: column; max-height: 92dvh; }
dialog header, dialog footer {
  display: flex; align-items: center; gap: .6rem;
  padding: .9rem 1.1rem; background: var(--superficie);
}
dialog header { border-bottom: 1px solid var(--borda); }
dialog footer { border-top: 1px solid var(--borda); }
dialog header h2 { margin: 0; flex: 1; font-size: 1rem; }
dialog .corpo { padding: 1.1rem; overflow-y: auto; }

.tamanho-linha { display: flex; align-items: center; gap: .6rem; margin-bottom: .4rem; }
.tamanho-linha input[type=text] { width: 90px; margin: 0; }
.tamanho-linha label { margin: 0; }

/* --------------------------------------------------------------- log */
.log {
  background: #1f1d1a; color: #e8e5df;
  padding: .8rem; border-radius: 8px;
  font-size: .8rem; white-space: pre-wrap; word-break: break-word;
  max-height: 260px; overflow: auto; margin: .8rem 0 0;
}

/* ------------------------------------------------------------- aviso */
.aviso {
  position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%);
  background: var(--texto); color: #fff;
  padding: .65rem 1.1rem; border-radius: 999px;
  font-size: .88rem; z-index: 100; box-shadow: var(--sombra);
  max-width: 92vw; text-align: center;
}
.aviso.ruim { background: var(--perigo); }
