/* Painel do lojista e Admin — mobile first */
:root {
  --cor: #1f1a17; --cor2: #e8a33d; --fundo: #f5f2ee; --cartao: #fff; --tinta: #1d1916; --suave: #6b625a;
  --linha: #e6dfd7; --ok: #127a3f; --perigo: #b42318; --raio: 16px;
  --fonte: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --titulo: ui-rounded, "SF Pro Rounded", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fundo); color: var(--tinta); font: 16px/1.45 var(--fonte); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 3px solid var(--cor2); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--titulo); letter-spacing: -.01em; }

/* Login */
.tela-login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(90% 60% at 100% 0%, rgba(232,163,61,.25), transparent 60%), var(--fundo); }
.caixa-login { width: 100%; max-width: 380px; background: var(--cartao); border-radius: 24px; padding: 28px 22px; box-shadow: 0 10px 40px rgba(29,25,22,.08); }
.caixa-login .selo { width: 52px; height: 52px; border-radius: 16px; background: var(--cor); color: #fff; display: grid; place-items: center; margin-bottom: 14px; }
.caixa-login .selo svg { width: 26px; height: 26px; }
.caixa-login h1 { margin: 0 0 4px; font-size: 26px; }
.caixa-login p { margin: 0 0 18px; color: var(--suave); }
.ajuda { font-size: 13px; color: var(--suave); margin-top: 16px; text-align: center; }

/* Campos */
.campo { display: block; margin-top: 14px; font-size: 14px; font-weight: 600; }
.campo > input, .campo > textarea, .campo > select, .campo .com-prefixo { display: block; width: 100%; margin-top: 6px; padding: 12px 14px; border: 1.5px solid var(--linha); border-radius: 12px; background: #fff; font-size: 16px; font-weight: 400; min-height: 48px; }
.campo > textarea { resize: vertical; min-height: 80px; }
.campo > input:focus, .campo > textarea:focus, .campo > select:focus { border-color: var(--cor); outline: none; }
.campo small { display: block; font-weight: 400; color: var(--suave); margin-top: 4px; }
.com-prefixo { display: flex !important; align-items: center; gap: 6px; padding: 0 14px !important; }
.com-prefixo input { border: 0; outline: none; flex: 1; min-width: 0; padding: 12px 0; font-size: 16px; background: transparent; }
.com-prefixo span { color: var(--suave); }
.cores { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cores input[type=color] { padding: 4px; height: 48px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 12px 18px; min-height: 48px; font-weight: 700; background: #ece6df; color: var(--tinta); text-decoration: none; font-size: 15px; }
.btn.primario { background: var(--cor); color: #fff; }
.btn.perigo { background: #fdecea; color: var(--perigo); }
.btn.cheio { width: 100%; margin-top: 18px; }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.pequeno { min-height: 40px; padding: 8px 12px; font-size: 14px; }
.msg-erro { color: var(--perigo); font-size: 14px; margin: 12px 0 0; min-height: 1em; }

/* Estrutura */
.app { max-width: 720px; margin: 0 auto; padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
.barra-topo { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: rgba(245,242,238,.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--linha); }
.barra-topo h1 { margin: 0; font-size: 19px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icone { width: 44px; height: 44px; border-radius: 12px; border: 0; background: #ece6df; display: grid; place-items: center; text-decoration: none; color: var(--tinta); flex: none; }
.conteudo { padding: 16px; }
.cabeca { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.cabeca h2 { margin: 0; font-size: 22px; }
.sub { color: var(--suave); font-size: 14px; margin: -6px 0 14px; }

.abas { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; justify-content: center; background: #fff; border-top: 1px solid var(--linha); padding-bottom: env(safe-area-inset-bottom); }
.abas button { flex: 1; max-width: 240px; border: 0; background: none; padding: 10px 4px 12px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; color: var(--suave); min-height: 60px; }
.abas button[aria-current="page"] { color: var(--tinta); }
.abas button[aria-current="page"] svg { color: var(--cor2); stroke-width: 2.2; }

/* Lista de produtos */
.busca { width: 100%; padding: 12px 14px; border: 1.5px solid var(--linha); border-radius: 12px; font-size: 16px; background: #fff; margin-bottom: 12px; min-height: 48px; }
.lista { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.item { background: var(--cartao); border-radius: var(--raio); padding: 10px; display: flex; gap: 10px; align-items: center; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.item .mini { width: 60px; height: 60px; border-radius: 12px; object-fit: cover; background: #efe9e2; flex: none; display: grid; place-items: center; color: var(--suave); font-weight: 800; }
.item .txt { flex: 1; min-width: 0; }
.item .txt strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 15px; line-height: 1.25; overflow: hidden; overflow-wrap: anywhere; }
.item .mini { width: 52px !important; height: 52px !important; }
.mini-chave { flex-direction: column; gap: 3px !important; }
.mini-chave small { font-size: 10px; font-weight: 700; color: var(--suave); text-transform: uppercase; letter-spacing: .03em; }
.mini-chave .trilho { width: 44px !important; height: 26px !important; }
.mini-chave .trilho::after { width: 20px !important; height: 20px !important; }
.mini-chave input:checked + .trilho::after { transform: translateX(18px) !important; }
.item .txt span { display: block; font-size: 13px; color: var(--suave); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item.off .mini { filter: grayscale(1); opacity: .6; }
.item .acoes { display: flex; align-items: center; gap: 4px; flex: none; }
.ordem { display: flex; flex-direction: column; gap: 2px; }
.ordem button { width: 34px; height: 26px; border: 0; border-radius: 8px; background: #f1ece6; display: grid; place-items: center; padding: 0; }
.ordem button svg { width: 16px; height: 16px; }
.ordem button:disabled { opacity: .3; }
.editar { width: 44px; height: 44px; border: 0; border-radius: 12px; background: #f1ece6; display: grid; place-items: center; }
.vazio { text-align: center; color: var(--suave); background: var(--cartao); border-radius: var(--raio); padding: 28px 16px; }

/* Interruptor */
.chave { position: relative; display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; cursor: pointer; }
.chave input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chave .trilho { width: 50px; height: 30px; border-radius: 999px; background: #d8d0c7; position: relative; transition: background .15s; flex: none; }
.chave .trilho::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.chave input:checked + .trilho { background: var(--perigo); }
.chave input:checked + .trilho::after { transform: translateX(20px); }
.chave input:focus-visible + .trilho { outline: 3px solid var(--cor2); outline-offset: 2px; }
.chave.verde input:checked + .trilho { background: var(--ok); }
.esg { font-size: 11px; font-weight: 700; color: var(--perigo); }

/* Folha de edição */
.folha { border: 0; padding: 0; width: 100%; max-width: 640px; height: 100%; max-height: 100%; margin: 0 auto; background: var(--fundo); color: var(--tinta); }
.folha::backdrop { background: rgba(20,16,14,.5); }
@media (min-width: 720px) { .folha { height: auto; max-height: 92vh; margin: auto; border-radius: 22px; } }
.folha-topo { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--fundo); border-bottom: 1px solid var(--linha); }
.folha-topo h2 { margin: 0; font-size: 19px; flex: 1; }
.folha-corpo { padding: 4px 16px 24px; }
.rodape-folha { position: sticky; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--fundo); border-top: 1px solid var(--linha); display: flex; gap: 10px; }
.rodape-folha .btn { flex: 1; }

.foto-box { margin-top: 12px; background: #fff; border: 1.5px dashed #d6cdc3; border-radius: 18px; padding: 12px; display: flex; gap: 12px; align-items: center; }
.foto-box .previa { width: 104px; height: 104px; border-radius: 14px; background: #efe9e2; object-fit: cover; flex: none; display: grid; place-items: center; color: var(--suave); overflow: hidden; }
.foto-box .previa img { width: 100%; height: 100%; object-fit: cover; }
.foto-box .botoes { display: grid; gap: 8px; flex: 1; min-width: 0; }
.foto-box .botoes label { cursor: pointer; }
.foto-box input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.status-foto { font-size: 13px; color: var(--suave); margin: 6px 0 0; min-height: 1em; }
.status-foto.erro { color: var(--perigo); }
.barra-prog { height: 6px; background: #ece6df; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.barra-prog i { display: block; height: 100%; width: 0; background: var(--cor2); transition: width .2s; }

.cartao { background: var(--cartao); border-radius: var(--raio); padding: 16px; margin-bottom: 14px; }
.cartao h3 { margin: 0 0 4px; font-size: 17px; }
.logo-prev { width: 84px; height: 84px; border-radius: 22px; object-fit: cover; background: #efe9e2; display: grid; place-items: center; font-weight: 800; font-size: 32px; color: var(--suave); overflow: hidden; }
.logo-prev img { width: 100%; height: 100%; object-fit: cover; }

.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(10px); background: #1d1916; color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 14px; z-index: 50; opacity: 0; transition: .2s; pointer-events: none; max-width: calc(100% - 32px); text-align: center; }
.toast.on { opacity: 1; transform: translateX(-50%); }
.toast.erro { background: var(--perigo); }

/* Admin */
.loja-adm { background: var(--cartao); border-radius: var(--raio); padding: 14px; margin-bottom: 12px; }
.loja-adm header { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.loja-adm h3 { margin: 0; font-size: 17px; overflow-wrap: anywhere; }
.loja-adm a { color: #6b4710; overflow-wrap: anywhere; }
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 99px; background: #e6f4ea; color: var(--ok); white-space: nowrap; }
.tag.off { background: #fdecea; color: var(--perigo); }
.tag.demo { background: #fff4e0; color: #7a4d00; }
.linha-acoes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.usuarios { margin: 10px 0 0; padding: 0; list-style: none; font-size: 14px; }
.usuarios li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid var(--linha); flex-wrap: wrap; }
.senha-box { background: #1d1916; color: #fff; border-radius: 14px; padding: 14px; font: 600 18px/1.4 ui-monospace, Consolas, monospace; word-break: break-all; margin: 10px 0; user-select: all; }
