/* SafMarket — folha unica. Tema claro/creme e o padrao; o escuro e escolha
   explicita do usuario (localStorage), nunca automatico. */
:root {
  --bg:#faf7f2; --surface:#fff; --surface-2:#f4f1ea; --ink:#17171a; --muted:#6b6f76;
  --line:#e9e4dc; --accent:#2563eb; --accent-ink:#fff; --ok:#12874a; --bad:#b3261e;
  --shadow:0 1px 2px rgba(20,20,25,.05), 0 8px 24px rgba(20,20,25,.06);
  --radius:12px;
}
[data-theme="dark"] {
  --bg:#14161a; --surface:#1c1f24; --surface-2:#232830; --ink:#f2f3f5; --muted:#9aa2ad;
  --line:#2b313a; --accent:#5b8cff; --accent-ink:#0d1117; --ok:#3ddc84; --bad:#ff6b6b;
  --shadow:0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
}
* { box-sizing:border-box; }
html { -webkit-text-size-adjust:100%; }
body { margin:0; background:var(--bg); color:var(--ink);
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  font-size:16px; line-height:1.55; }
a { color:var(--accent); }
img { max-width:100%; display:block; }

/* cabecalho */
header { position:sticky; top:0; z-index:20; background:var(--surface);
  border-bottom:1px solid var(--line); padding:10px 16px;
  display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
header .brand { font-weight:700; font-size:18px; letter-spacing:-.2px; color:var(--ink);
  text-decoration:none; display:flex; align-items:center; gap:8px; }
header .brand svg { width:22px; height:22px; flex:none; }
header .spacer { flex:1; }
header nav { display:flex; align-items:center; gap:2px; flex-wrap:wrap; }
header nav a { color:var(--muted); text-decoration:none; font-size:15px;
  padding:11px 12px; border-radius:9px; min-height:44px; display:inline-flex;
  align-items:center; gap:6px; }
header nav a:hover, header nav a:focus-visible { color:var(--ink); background:var(--surface-2); }
header nav a[aria-current="page"] { color:var(--ink); font-weight:600; background:var(--surface-2); }
#cart-count { min-width:22px; height:22px; padding:0 6px; border-radius:999px;
  background:var(--accent); color:var(--accent-ink); font-size:12px; font-weight:700;
  display:inline-flex; align-items:center; justify-content:center; }
#theme-toggle { background:transparent; border:1px solid var(--line); color:var(--muted);
  border-radius:10px; width:44px; height:44px; display:inline-flex; align-items:center;
  justify-content:center; cursor:pointer; flex:none; }
#theme-toggle:hover { color:var(--ink); border-color:var(--muted); }
#theme-toggle svg { width:19px; height:19px; }

/* conteudo */
main { max-width:1000px; margin:0 auto; padding:26px 16px 56px; }
h1 { font-size:26px; line-height:1.25; margin:0 0 8px; letter-spacing:-.4px; }
h2 { font-size:19px; margin:26px 0 10px; letter-spacing:-.2px; }
h3 { font-size:16px; margin:0; font-weight:600; }
p.sub { color:var(--muted); margin:0 0 22px; font-size:15px; }
.note { color:var(--muted); font-size:14px; }

/* vitrine */
.grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); gap:16px; }
.card { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
  padding:16px; display:flex; flex-direction:column; gap:10px; box-shadow:var(--shadow);
  transition:transform .18s ease, border-color .18s ease; }
.card:hover { transform:translateY(-2px); border-color:var(--muted); }
.card .thumb { height:150px; border-radius:9px; background:var(--surface-2);
  display:flex; align-items:center; justify-content:center; overflow:hidden; }
.card .thumb img { max-height:100%; object-fit:contain; }
.card .price { font-size:20px; font-weight:700; }
.card .inst { color:var(--muted); font-size:13px; }
.card .actions { display:flex; gap:8px; margin-top:auto; padding-top:6px; }
.card .actions .btn { flex:1; }

/* botoes: 44px de altura minima (alvo de toque) */
.btn { display:inline-flex; align-items:center; justify-content:center; gap:8px;
  min-height:44px; padding:11px 18px; border:0; border-radius:10px; background:var(--accent);
  color:var(--accent-ink); font-size:15px; font-weight:600; font-family:inherit;
  cursor:pointer; text-decoration:none; text-align:center; transition:filter .15s ease; }
.btn:hover { filter:brightness(1.08); }
.btn:disabled { opacity:.6; cursor:progress; }
.btn.ghost { background:var(--surface); color:var(--ink); border:1px solid var(--line); }
.btn.danger { background:var(--surface); color:var(--bad); border:1px solid var(--bad); }
.btn:focus-visible, a:focus-visible, button:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }

/* formularios */
input[type=text], input[type=email], input[type=search], input[type=number], select, textarea {
  font:inherit; color:var(--ink); background:var(--surface); border:1px solid var(--line);
  border-radius:10px; padding:11px 13px; min-height:44px; width:100%; max-width:420px; }
input:focus { outline:2px solid var(--accent); outline-offset:1px; border-color:var(--accent); }
label { display:block; font-size:14px; font-weight:600; margin:14px 0 6px; }

/* produto */
.item { display:grid; grid-template-columns:1fr 1fr; gap:28px; background:var(--surface);
  border:1px solid var(--line); border-radius:var(--radius); padding:22px; box-shadow:var(--shadow); }
.item .fig { background:var(--surface-2); border-radius:10px; min-height:240px;
  display:flex; align-items:center; justify-content:center; overflow:hidden; }
.item .fig img { max-height:320px; object-fit:contain; }
.item .buy { display:flex; flex-direction:column; gap:14px; }
.item .big { font-size:28px; font-weight:700; letter-spacing:-.5px; }

/* carrinho */
.cart { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
  overflow:hidden; box-shadow:var(--shadow); }
.cart .row { display:flex; align-items:center; gap:14px; padding:14px 16px;
  border-bottom:1px solid var(--line); flex-wrap:wrap; }
.cart .row:last-child { border-bottom:0; }
.cart .row .grow { flex:1; min-width:160px; }
.cart .row .qty { color:var(--muted); font-size:14px; }
.cart .total { display:flex; justify-content:space-between; font-weight:700; font-size:17px;
  padding:16px; background:var(--surface-2); }
.cart .empty { padding:26px 16px; color:var(--muted); }

/* resultado de pagamento */
dl.result { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
  padding:18px 20px; box-shadow:var(--shadow); }
dl.result div { display:flex; justify-content:space-between; gap:16px; padding:9px 0;
  border-bottom:1px solid var(--line); }
dl.result div:last-child { border-bottom:0; }
dl.result dt { color:var(--muted); font-size:14px; margin:0; }
dl.result dd { margin:0; font-weight:600; font-size:14px; word-break:break-all; text-align:right; }
.badge { display:inline-block; padding:6px 13px; border-radius:999px; font-size:13px; font-weight:600; }
.badge.ok { background:rgba(18,135,74,.12); color:var(--ok); }
.badge.bad { background:rgba(179,38,30,.12); color:var(--bad); }
.badge.warn { background:rgba(138,90,0,.14); color:#8a5a00; }
[data-theme="dark"] .badge.warn { color:#e8b04b; }
.entrega { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
  padding:18px; margin:16px 0; box-shadow:var(--shadow); }
.entrega h3 { margin:0 0 8px; font-size:16px; }
.tag { display:inline-block; background:rgba(37,99,235,.1); color:var(--accent);
  border-radius:999px; padding:4px 11px; font-size:12px; font-weight:600; }
.alert { border:1px solid var(--line); border-left:4px solid var(--accent); background:var(--surface);
  border-radius:10px; padding:14px 16px; margin:16px 0; }

/* texto longo (legais) */
.doc { max-width:820px; }
.doc h2 { margin-top:28px; }
.doc p, .doc li { color:var(--muted); line-height:1.7; }
.fill { background:rgba(255,193,7,.25); padding:1px 6px; border-radius:5px; color:var(--ink); }

/* rodape */
footer.legal { max-width:1000px; margin:20px auto 40px; padding:22px 16px 0;
  border-top:1px solid var(--line); color:var(--muted); font-size:14px; }
footer.legal a { color:var(--muted); }
footer.legal nav { display:flex; gap:4px; flex-wrap:wrap; margin-top:6px; }
footer.legal nav a { padding:10px 10px; min-height:44px; display:inline-flex; align-items:center; }

@media (max-width:720px) {
  .item { grid-template-columns:1fr; padding:16px; }
  .grid { grid-template-columns:1fr; }
  h1 { font-size:23px; }
  header { padding:8px 12px; gap:8px; }
  /* marca e botao de tema na primeira linha; navegacao em linha propria,
     sem deixar item solto embaixo do outro */
  header .brand { order:1; }
  header .spacer { display:none; }
  #theme-toggle { order:2; margin-left:auto; }
  header nav { order:3; flex-basis:100%; justify-content:space-between; gap:0; }
  header nav a { padding:11px 8px; font-size:14px; }
  /* item secundario sai do menu no mobile para nao quebrar linha sozinho
     (continua acessivel no rodape) */
  header nav a.so-desktop { display:none; }
}
@media (prefers-reduced-motion:reduce) { * { transition:none !important; } }

/* --- kit de confiança (20/10/2026): dados do vendedor visíveis no rodapé --- */
footer.legal .institucional { display:grid; gap:2px; margin-bottom:10px; }
footer.legal .institucional p { margin:0; line-height:1.5; }
footer.legal .institucional strong { color:var(--fg); }
