:root {
  --bg: #f3f2ef; --card: #fff; --line: #e4e2dd; --text: #1c1b19; --muted: #6b6862; --soft: #8d8a83;
  --green: #22c55e; --green-d: #16a34a; --green-bg: #e7f3ea; --green-t: #166534;
  --red: #a52a2a; --warn-bg: #fff4dc; --warn-t: #8a5a00; --err-bg: #fde8e6; --err-t: #9b1c1c;
  --info-bg: #e8f0fe; --info-t: #1e429f; --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 14px rgba(0,0,0,.04);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 'Outfit', system-ui, sans-serif; }
a { color: inherit; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { max-width: 1260px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
.serif { font-family: 'Fraunces', Georgia, serif; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }

/* header */
.topo { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topo .wrap { display: flex; align-items: center; justify-content: space-between; height: 58px; gap: 12px; }
.logo { text-decoration: none; } .logo img { height: 40px; width: auto; } .logo b { font-size: 20px; }
.icones { display: flex; gap: 6px; align-items: center; }
.icone { position: relative; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px;
  border: 0; background: none; cursor: pointer; text-decoration: none; }
.icone:hover { background: var(--bg); }
.icone svg { width: 21px; height: 21px; }
.badge { position: absolute; top: 2px; right: 0; background: var(--green-d); color: #fff; font-size: 11px;
  min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; font-weight: 600; }
.badge:empty { display: none; }

/* barra do catálogo */
.barra { padding: 12px 0 14px; border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 58px; z-index: 15; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: var(--green-bg); color: var(--green-t);
  border-radius: 999px; padding: 6px 13px; font-weight: 500; font-size: 14px; border: 0; }
.pill svg { width: 16px; height: 16px; }
.pill.cinza { background: #ecebe7; color: var(--text); }
.linha-pills { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.busca { display: flex; gap: 8px; }
.btn-cat { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 0 14px; height: 48px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.campo-busca { flex: 1; display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 0 14px; height: 48px; min-width: 0; }
.campo-busca input { border: 0; outline: 0; flex: 1; min-width: 0; background: none; font-size: 16px; }
.cats { display: none; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.cats.aberto { display: flex; }
.cats button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.cats button.ativo { background: var(--text); color: #fff; border-color: var(--text); }

/* banners da distribuidora */
.banners { position: relative; margin-top: 16px; border-radius: var(--radius); overflow: hidden; background: #e9e7e2; }
.banners-trilho { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; scroll-behavior: smooth; }
.banners-trilho::-webkit-scrollbar { display: none; }
.banners-trilho img { flex: 0 0 100%; width: 100%; aspect-ratio: 16 / 5; object-fit: cover; scroll-snap-align: start; }
.banners-pontos { position: absolute; bottom: 10px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.banners-pontos button { width: 8px; height: 8px; border-radius: 4px; border: 0; background: rgba(255,255,255,.6); cursor: pointer; padding: 0; transition: width .2s; }
.banners-pontos button.on { width: 22px; background: #fff; }
@media (max-width: 720px) { .banners-trilho img { aspect-ratio: 16 / 7; } }

/* grade de produtos */
.grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; padding: 18px 0 110px; }
.prod { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; box-shadow: var(--shadow); }
.prod .foto { aspect-ratio: 1 / 1; background: #f7f6f3; display: grid; place-items: center; overflow: hidden; margin: 4px; border-radius: 10px; }
.prod .foto img { width: 100%; height: 100%; object-fit: cover; }
.prod .foto .sem { color: var(--soft); font-size: 13px; }
.prod .corpo { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.prod .ref { font-size: 12.5px; color: var(--muted); }
.prod .nome { font-weight: 500; font-size: 16.5px; }
.prod .det { font-size: 13px; color: var(--muted); white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden; }
.prod .precos { margin-top: auto; padding-top: 10px; }
.prod .p-un { font-size: 13.5px; color: var(--muted); }
.prod .p-main { font-size: 21px; font-weight: 700; color: var(--green-d); }
.prod .p-main small { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.prod .tag { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 999px; background: var(--warn-bg); color: var(--warn-t); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 10px;
  height: 44px; padding: 0 18px; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn-verde { background: var(--green); color: #fff; } .btn-verde:hover { background: var(--green-d); }
.btn-verm { background: var(--red); color: #fff; } .btn-verm:hover { filter: brightness(.93); }
.btn-borda { background: #fff; border: 1px solid var(--line); color: var(--text); }
.btn-bloco { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 14px; border-radius: 8px; }
.add { margin-top: 10px; }
.stepper { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.stepper button { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-size: 20px; cursor: pointer; }
.stepper input { flex: 1; min-width: 0; height: 44px; text-align: center; border: 1px solid var(--line); border-radius: 10px; font-weight: 600; }
.modo { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-top: 10px; }
.modo button { flex: 1; height: 32px; border: 0; background: #fff; cursor: pointer; font-size: 13px; }
.modo button.ativo { background: var(--text); color: #fff; }

/* barra do carrinho */
.carrinho-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: #fff; border-top: 1px solid var(--line); display: none; }
.carrinho-bar.on { display: block; }
.carrinho-bar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0; }

/* painéis, formulários, tabelas */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.form label { display: block; font-size: 14px; color: var(--muted); margin: 12px 0 6px; }
.form input, .form select, .form textarea { width: 100%; height: 46px; border: 1px solid var(--line); border-radius: 10px;
  padding: 0 12px; background: #fff; }
.form textarea { height: 90px; padding: 10px 12px; }
.form .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.alerta { padding: 10px 14px; border-radius: 10px; margin: 10px 0; font-size: 14px; }
.alerta.erro { background: var(--err-bg); color: var(--err-t); } .alerta.ok { background: var(--green-bg); color: var(--green-t); }
.alerta.warn { background: var(--warn-bg); color: var(--warn-t); } .alerta.info { background: var(--info-bg); color: var(--info-t); }
.st { display: inline-block; font-size: 12.5px; padding: 2px 9px; border-radius: 999px; font-weight: 500; }
.st.ok { background: var(--green-bg); color: var(--green-t); } .st.erro { background: var(--err-bg); color: var(--err-t); }
.st.warn { background: var(--warn-bg); color: var(--warn-t); } .st.info { background: var(--info-bg); color: var(--info-t); }
table.tab { width: 100%; border-collapse: collapse; font-size: 14px; }
.tab th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tab td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tab .num { text-align: right; white-space: nowrap; }
.tabela-rol { overflow-x: auto; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(20,18,15,.45); display: none; place-items: center; z-index: 50; padding: 16px; }
.modal.on, .modal:target { display: grid; }
.modal .card { width: 100%; max-width: 420px; }

/* área interna */
.area-topo { background: #fff; border-bottom: 1px solid var(--line); }
.area-topo .wrap { display: flex; align-items: center; gap: 18px; height: 56px; overflow-x: auto; }
.area-topo nav { display: flex; gap: 4px; flex: 1; }
.area-topo nav a { text-decoration: none; padding: 7px 11px; border-radius: 8px; white-space: nowrap; color: var(--muted); }
.area-topo nav a.on, .area-topo nav a:hover { background: var(--bg); color: var(--text); }
.area { padding: 22px 0 60px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.kpi b { display: block; font-size: 24px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.inicio { max-width: 560px; margin: 0 auto; padding: 50px 16px 60px; text-align: center; }
.inicio .logo-g img { max-height: 90px; margin: 0 auto 26px; }
.marcas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px 18px; margin: 34px 0; align-items: center; }
.marcas img { max-height: 58px; margin: 0 auto; object-fit: contain; }
.sep { width: 46px; height: 1px; background: var(--line); margin: 26px auto; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 330px; padding: 20px; }
.kicker { font-size: 11.5px; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; }
code.token { display: block; padding: 12px; background: #1c1b19; color: #b8f5c9; border-radius: 10px; word-break: break-all; }
.vazio { padding: 60px 0; text-align: center; color: var(--muted); }

@media (max-width: 720px) {
  .grade { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .prod .corpo { padding: 10px; } .prod .nome { font-size: 15px; } .prod .p-main { font-size: 18px; }
  .prod .det { -webkit-line-clamp: 2; }
  .btn-cat span { display: none; }
  .cols, .form .grid2 { grid-template-columns: 1fr; }
  .marcas { gap: 20px 12px; }
}
@media (max-width: 360px) { .grade { grid-template-columns: 1fr; } }
