/* ═══════════════════════════════════════════════════════════════
   Catálogo TOP COMERCIAL — tema "1b Marketplace clean" (07/07/26)
   Fundo claro, cards brancos com respiro, busca dominante no header,
   selo CA azul de confiança, CTA laranja. Fonte: Manrope.
   ═══════════════════════════════════════════════════════════════ */
:root {
  --bg: #f4f6f8;
  --fg: #1a2532;
  --titulo: #0f2033;
  --muted: #6b7686;
  --muted2: #9aa6b4;
  --card: #ffffff;
  --border: #e4e8ee;
  --border2: #eceff3;
  --azul: #003F7F;
  --azul-claro: #eaf3ff;
  --laranja: #FF6B00;
  --laranja-hover: #e85f00;
  --verde-zap: #25D366;
  --shadow: 0 1px 2px rgba(20,40,60,.04);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--fg);
  font-size: 15px;
  line-height: 1.5;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}
.muted { color: var(--muted); }

/* ───────── Header (busca dominante) ───────── */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border2);
  box-shadow: 0 1px 2px rgba(20,40,60,.06);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 68px;
  padding-top: 8px;
  padding-bottom: 8px;
  flex-wrap: wrap;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; user-select: none;
  text-decoration: none; color: inherit;
}
.brand-logo {
  height: 44px; width: auto; display: block;
  object-fit: contain; border-radius: 8px;
}
.brand-sep {
  width: 1px; height: 26px; background: #d8dee6; border-radius: 1px;
}
.brand-catalogo {
  font-size: 18px; font-weight: 800; color: var(--titulo);
  letter-spacing: .2px;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 520px;
}
.search-wrap svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  pointer-events: none;
}
.search-wrap input {
  width: 100%; height: 46px;
  border-radius: 24px;
  background: #f6f8fa;
  border: 1px solid #dfe4ea;
  padding: 0 18px 0 42px;
  font-size: 15px;
  font-family: inherit;
  color: var(--fg);
  outline: none;
}
.search-wrap input:focus { border-color: var(--azul); background: #fff; }
.search-wrap input::placeholder { color: var(--muted2); }

.topo-acoes { display: flex; align-items: center; gap: 10px; margin-left: auto; }

/* sub-barra: contador + filtros */
.subbar { background: #fff; border-top: 1px solid var(--border2); }
.subbar-inner {
  display: flex; align-items: center; gap: 14px;
  padding-top: 9px; padding-bottom: 9px;
  flex-wrap: wrap;
}
.subbar-status {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--muted);
  white-space: nowrap;
}
#status-total { font-weight: 700; color: #33414f; }
.subbar-filtros { display: flex; gap: 10px; margin-left: auto; flex-wrap: wrap; }
.subbar-filtros select {
  height: 42px;
  border-radius: 10px;
  border: 1px solid #dfe4ea;
  background: #fff;
  color: #33414f;
  font-size: 13.5px;
  font-family: inherit;
  padding: 0 10px;
  max-width: 230px;
  cursor: pointer;
}
.subbar-filtros select:focus { border-color: var(--azul); outline: none; }

/* botões do topo */
.btn-cart {
  position: relative;
  background: #fff; border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 14px;
  font-size: 16px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  font-family: inherit;
}
.btn-cart:hover { border-color: var(--azul); }
.cart-badge {
  background: var(--laranja); color: #fff;
  border-radius: 999px; font-size: 11px; font-weight: 800;
  min-width: 20px; height: 20px; line-height: 20px; text-align: center;
  padding: 0 5px;
}
.btn-cart.vazio .cart-badge { background: #c3cbd5; }

.btn-conta {
  background: #fff; border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 14px;
  font-size: 14px; font-weight: 700; color: var(--azul);
  cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
  font-family: inherit;
}
.btn-conta:hover { border-color: var(--azul); background: var(--azul-claro); }

/* Modal de conta / login (placeholder) */
.conta-box { text-align: center; max-width: 360px; margin: 0 auto; padding: 8px 4px 4px; }
.conta-avatar {
  width: 62px; height: 62px; border-radius: 50%; background: var(--azul);
  display: flex; align-items: center; justify-content: center; margin: 0 auto;
}
.btn-conta-entrar {
  display: block; margin: 4px 0 10px; padding: 13px; border-radius: 12px;
  background: var(--laranja); color: #fff; font-weight: 700; font-size: 15px;
  text-decoration: none; text-align: center;
}
.btn-conta-entrar:hover { filter: brightness(.96); }
.conta-cadastro { display: block; font-size: 14px; font-weight: 700; color: var(--azul); text-decoration: none; }
.conta-cadastro:hover { text-decoration: underline; }
.conta-nota { font-size: 12px; margin: 20px 0 0; }
.conta-input {
  width: 100%; padding: 13px 14px; border: 1px solid var(--border);
  border-radius: 12px; font-size: 15px; font-family: inherit; margin-bottom: 10px;
  outline: none; box-sizing: border-box;
}
.conta-input:focus { border-color: var(--azul); }
.conta-codigo { text-align: center; letter-spacing: 8px; font-weight: 800; font-size: 22px; }
.conta-erro { color: #a02424; font-size: 13px; font-weight: 600; margin: 0 0 10px; }
.conta-opcoes { display: flex; flex-direction: column; gap: 8px; }
.conta-opcao {
  padding: 13px 14px; border: 1px solid var(--border); border-radius: 12px;
  background: #fff; font-size: 14px; font-weight: 700; color: var(--titulo);
  cursor: pointer; font-family: inherit; text-align: left;
}
.conta-opcao:hover { border-color: var(--azul); background: var(--azul-claro); }
.conta-embreve {
  background: var(--azul-claro); color: var(--azul); border-radius: 12px;
  padding: 13px 15px; font-size: 13px; line-height: 1.5; text-align: left;
}
.conta-credito-load { font-size: 13px; color: var(--muted, #8a95a3); padding: 10px 0; }
.conta-credito {
  background: linear-gradient(135deg, #003F7F, #0a5cb0); color: #fff;
  border-radius: 14px; padding: 16px 18px; margin-bottom: 12px; text-align: left;
}
.conta-credito .cc-label { font-size: 12px; font-weight: 600; opacity: .85; }
.conta-credito .cc-valor { font-size: 26px; font-weight: 800; margin-top: 2px; }
.conta-credito .cc-sub { font-size: 12px; opacity: .8; margin-top: 2px; }
.conta-credito .cc-extra { font-size: 12.5px; font-weight: 600; margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.2); }
.conta-credito .cc-vencido { color: #ffd7a8; }
.conta-hist-titulo { font-size: 13px; font-weight: 800; color: var(--titulo); text-align: left; margin: 4px 0 8px; }
.conta-hist-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 7px;
}
.conta-hist-item .chi-esq { display: flex; flex-direction: column; align-items: flex-start; }
.conta-hist-item .chi-num { font-size: 13px; font-weight: 700; color: var(--titulo); }
.conta-hist-item .chi-data { font-size: 11.5px; color: var(--muted, #8a95a3); }
.conta-hist-item .chi-dir { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.conta-hist-item .chi-valor { font-size: 13.5px; font-weight: 800; color: var(--azul); }
.conta-hist-item .chi-status { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.chi-status.st-fat { background: #dcfce7; color: #166534; }
.chi-status.st-bxo { background: #e0edff; color: #1e40af; }
.chi-status.st-proc { background: #fef3c7; color: #92400e; }
.btn-conta.logado { color: #052e16; background: var(--verde-zap); border-color: var(--verde-zap); }

/* Preços por cliente (Fase 2) */
.card-preco { min-height: 22px; margin: 2px 0 2px; }
.preco-valor { font-size: 17px; font-weight: 800; color: var(--azul); }
.preco-indisp { font-size: 12px; font-weight: 600; color: var(--muted, #8a95a3); }
.preco-login {
  background: var(--azul-claro); color: var(--azul); border: 1px dashed var(--azul);
  border-radius: 9px; padding: 5px 10px; font-size: 12px; font-weight: 700;
  cursor: pointer; font-family: inherit;
}
.preco-login:hover { background: #dcebff; }
.det-preco { margin: 4px 0 6px; min-height: 28px; }
.preco-valor-det { font-size: 26px; font-weight: 800; color: var(--azul); }
.preco-un { font-size: 13px; font-weight: 600; color: var(--muted, #8a95a3); }
.preco-carregando { color: #c3ccd5; }
.det-copiar {
  width: 100%; margin-top: 8px; padding: 10px; border-radius: 10px;
  background: #fff; border: 1px solid var(--border); color: var(--azul);
  font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.det-copiar:hover { border-color: var(--azul); background: var(--azul-claro); }

.btn-whatsapp {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--verde-zap); color: #052e16;
  border: none; border-radius: 12px;
  padding: 10px 16px;
  font-size: 14px; font-weight: 700;
  text-decoration: none; cursor: pointer;
  font-family: inherit;
}
.btn-whatsapp:hover { filter: brightness(.96); }
.btn-whatsapp:active { transform: scale(.98); }

.btn-sync {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; border: 1px solid var(--border);
  border-radius: 10px; padding: 7px 12px;
  font-size: 12.5px; cursor: pointer; color: #33414f;
  font-family: inherit;
}
.btn-sync:hover { border-color: var(--azul); }
.btn-sync.syncing { opacity: .6; cursor: wait; }
.btn-sync:disabled { opacity: .5; cursor: not-allowed; }
.hidden { display: none !important; }

/* ───────── Grid de cards ───────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
  padding-top: 22px;
  padding-bottom: 10px;
}
.empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 60px 0;
  font-size: 15px;
}

.card {
  background: var(--card);
  border: 1px solid #e8ebef;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.card-click { cursor: pointer; transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease; }
.card-click:hover {
  border-color: var(--azul);
  box-shadow: 0 10px 24px -12px rgba(0,63,127,.18);
  transform: translateY(-2px);
}
.card-img {
  height: 190px;
  background: #fbfcfd;
  border-bottom: 1px solid #f0f2f5;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.card-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.card-img.placeholder { color: var(--muted2); font-size: 13px; }
.card-body { padding: 15px 16px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-codigo {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px; font-weight: 600;
  color: var(--muted);
}
.card-descricao {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-titulo-link { color: inherit; text-decoration: none; }
.card-titulo-link:hover { text-decoration: underline; }
.card-aplicacao {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.badge-ca { background: var(--azul-claro); color: var(--azul); }
.badge-ca::before { content: '🛡'; font-size: 10px; }
.badge-tam   { background: #f0f2f5; color: #33414f; }
.badge-marca { background: #eef7ee; color: #1b7a2f; }
.badge-grupo { background: #fdf1e3; color: #a05a00; }
.card-meta {
  margin-top: auto;
  padding-top: 8px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--muted2);
}
.card-marca { font-weight: 700; color: var(--muted); }

/* ───────── Paginação ───────── */
.paginacao {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding-top: 8px; padding-bottom: 40px;
  font-size: 14px;
}
.paginacao button {
  background: #fff; border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 16px;
  font-size: 13.5px; font-weight: 600; color: #33414f;
  cursor: pointer; font-family: inherit;
}
.paginacao button:hover:not(:disabled) { border-color: var(--azul); color: var(--azul); }
.paginacao button:disabled { opacity: .4; cursor: not-allowed; }
.paginacao .info { color: var(--muted); }

/* ───────── Modal ───────── */
.modal {
  position: fixed; inset: 0;
  background: rgba(15,32,51,.5);
  display: flex; align-items: center; justify-content: center;
  padding: 18px; z-index: 100;
}
.modal.hidden { display: none; }
body.modal-aberto { overflow: hidden; }
.modal-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 860px; width: 100%;
  max-height: 92vh; overflow-y: auto;
  position: relative;
  box-shadow: 0 40px 80px -30px rgba(20,40,60,.35);
}
.modal-fechar {
  position: absolute; top: 12px; right: 14px;
  background: #f4f6f8; border: 1px solid var(--border); border-radius: 999px;
  width: 36px; height: 36px; font-size: 14px; cursor: pointer; color: #33414f;
  z-index: 2;
}
.modal-fechar:hover { border-color: var(--azul); color: var(--azul); }
.modal-body { padding: 24px; }

.det-grid { display: grid; grid-template-columns: 320px 1fr; gap: 24px; }
@media (max-width: 720px) { .det-grid { grid-template-columns: 1fr; } }
.det-foto {
  background: #fbfcfd; border: 1px solid var(--border2); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  min-height: 260px; overflow: hidden;
}
.det-foto img { max-width: 100%; max-height: 340px; object-fit: contain; }
.det-foto .placeholder, .det-foto.placeholder { color: var(--muted2); font-size: 13px; }
.det-titulo {
  margin: 4px 0 8px;
  font-size: 20px; font-weight: 800;
  color: var(--titulo);
  line-height: 1.3;
}
.det-label {
  font-size: 11px; font-weight: 800; letter-spacing: .6px;
  text-transform: uppercase; color: var(--muted2); margin-bottom: 3px;
}
.det-bloco { margin-top: 14px; }
.det-bloco p { margin: 2px 0 0; font-size: 14px; color: #33414f; }
.det-tams { margin-top: 14px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1.5px solid #dfe4ea; background: #fff;
  border-radius: 10px; padding: 9px 14px;
  font-size: 14px; font-weight: 700; cursor: pointer; color: #33414f;
  min-width: 46px; min-height: 44px;
  font-family: inherit;
}
.chip:hover { border-color: var(--azul); color: var(--azul); }
.chip.sel { background: var(--azul); border-color: var(--azul); color: #fff; }

.det-cart { display: flex; gap: 10px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.qtd-stepper {
  display: inline-flex; align-items: center;
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  background: #fff;
}
.qtd-stepper button {
  background: #f6f8fa; border: none; width: 42px; height: 44px;
  font-size: 18px; cursor: pointer; color: #33414f;
}
.qtd-stepper button:hover { background: #eceff3; }
.qtd-stepper input {
  border: none; width: 56px; height: 44px; text-align: center;
  font-size: 15px; font-weight: 700; outline: none;
  font-family: inherit;
  -moz-appearance: textfield;
}
.qtd-stepper input::-webkit-outer-spin-button, .qtd-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qtd-mini button { width: 32px; height: 34px; font-size: 15px; }
.qtd-mini input { width: 46px; height: 34px; font-size: 13.5px; }

.btn-add-cart {
  flex: 1; min-width: 200px;
  background: var(--laranja); color: #fff; border: none;
  border-radius: 12px; padding: 12px 16px;
  font-size: 15px; font-weight: 800; cursor: pointer;
  font-family: inherit;
  box-shadow: 0 6px 16px -8px rgba(255,107,0,.5);
}
.btn-add-cart:hover { background: var(--laranja-hover); }
.btn-whats-produto {
  margin-top: 12px;
  justify-content: center;
  font-size: 15px;
  padding: 12px 18px;
  width: 100%;
}
.det-dica { margin-top: 8px; font-size: 12.5px; color: var(--muted); text-align: center; }

/* ───────── Carrinho ───────── */
.cart-lista { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.cart-item {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--border); border-radius: 12px; padding: 11px 13px;
  background: #fff;
}
.cart-item-foto {
  width: 48px; height: 48px; flex: none; border-radius: 9px;
  background: radial-gradient(circle at 50% 40%, #f6f8fb, #edf0f5);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.cart-item-foto img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.cart-memo {
  background: var(--azul-claro); color: var(--azul);
  border-radius: 12px; padding: 12px 14px; margin: 14px 0 12px;
  font-size: 13px; line-height: 1.5; font-weight: 600;
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-titulo { font-size: 13.5px; font-weight: 600; margin: 2px 0 4px; color: var(--fg); }
.cart-remover {
  background: none; border: none; color: #b6bfc9;
  font-size: 15px; cursor: pointer; padding: 8px;
}
.cart-remover:hover { color: #d33; }
.cart-limpar {
  display: block; margin: 10px auto 0;
  background: none; border: none; color: var(--muted);
  font-size: 13px; cursor: pointer; text-decoration: underline;
  font-family: inherit;
}
.cart-vazio { text-align: center; padding: 34px 10px; color: var(--muted); }
.cart-vazio div:first-child {
  width: 84px; height: 84px; margin: 0 auto 10px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
}

/* ───────── Toast ───────── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #0f2033; color: #fff;
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 14px; font-weight: 600;
  box-shadow: 0 10px 30px rgba(15,32,51,.35);
  z-index: 200;
  max-width: 92vw;
}
.toast.erro { background: #a02020; }
.toast.hidden { display: none; }

/* ───────── Mobile ───────── */
@media (max-width: 760px) {
  .topbar-inner { gap: 10px; }
  .search-wrap { order: 3; flex-basis: 100%; max-width: none; }
  .brand-logo { height: 38px; }
  .brand-catalogo { font-size: 16px; }
  .subbar-inner { gap: 8px; }
  .subbar-status { flex-basis: 100%; }
  .subbar-filtros { margin-left: 0; width: 100%; }
  .subbar-filtros select { flex: 1; min-width: 0; max-width: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .card-img { height: 140px; }
  .modal { padding: 8px; }
  .modal-body { padding: 16px; }
  .btn-whatsapp span { display: none; }
  .btn-whatsapp { padding: 10px 12px; }
}
