/* JK Personalizados - estilos */
:root {
  --azul: #2563eb;
  --azul-esc: #1d4ed8;
  --azul-claro: #eff6ff;
  --texto: #1f2937;
  --suave: #6b7280;
  --borda: #e5e7eb;
  --fundo: #f6f7fb;
  --branco: #fff;
  --verde: #16a34a;
  --vermelho: #dc2626;
  --laranja: #ea580c;
  --amarelo: #ca8a04;
  --raio: 10px;
  --sombra: 0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.05);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--texto); background: var(--fundo); font-size: 15px; line-height: 1.5;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--azul); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1 { font-size: 1.6rem; margin: 0 0 .4em; }
h2 { font-size: 1.25rem; margin: 1.2em 0 .5em; }
h3 { font-size: 1.05rem; margin: 0 0 .4em; }
small, .suave { color: var(--suave); }

/* ---------- topo ---------- */
.topo { background: var(--branco); border-bottom: 1px solid var(--borda); position: sticky; top: 0; z-index: 50; }
.topo-in { max-width: 1400px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 16px; min-height: 60px; }
.marca { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; color: var(--texto); white-space: nowrap; }
.marca:hover { text-decoration: none; }
.marca small { color: var(--azul); font-weight: 600; font-size: .75rem; margin-left: 4px; }
.menu { display: flex; align-items: center; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.menu > a:not(.btn) { color: var(--texto); padding: 8px 10px; border-radius: 8px; font-weight: 500; }
.menu > a:not(.btn):hover { background: var(--fundo); text-decoration: none; }
.menu > a.ativo { color: var(--azul); background: var(--azul-claro); }
.menu-sep { width: 1px; height: 24px; background: var(--borda); margin: 0 6px; }
.menu .usuario { padding: 0 6px; color: var(--suave); }
.menu .usuario strong { color: var(--texto); }
.menu .btn { margin-left: 4px; }
.contador { background: var(--azul); color: #fff; border-radius: 99px; font-size: .72rem; padding: 1px 7px; font-weight: 700; }
.menu-btn { display: none; margin-left: auto; background: none; border: 1px solid var(--borda); border-radius: 8px; font-size: 1.3rem; padding: 4px 12px; cursor: pointer; }

@media (max-width: 900px) {
  .menu-btn { display: block; }
  .menu { display: none; position: absolute; top: 100%; left: 0; right: 0; background: #fff; flex-direction: column; align-items: stretch; padding: 8px 16px 16px; border-bottom: 1px solid var(--borda); box-shadow: var(--sombra); }
  .menu.aberto { display: flex; }
  .menu-sep { width: 100%; height: 1px; margin: 6px 0; }
  .menu .btn { margin: 4px 0 0; }
}

/* ---------- conteudo ---------- */
.conteudo { max-width: 1100px; width: 100%; margin: 0 auto; padding: 24px 16px 48px; flex: 1; }
.conteudo.largo { max-width: 1300px; }
.rodape { text-align: center; color: var(--suave); font-size: .85rem; padding: 18px 16px; border-top: 1px solid var(--borda); background: #fff; }
.cartao { background: #fff; border: 1px solid var(--borda); border-radius: var(--raio); padding: 20px; box-shadow: var(--sombra); }
.cartao + .cartao { margin-top: 16px; }
.estreito { max-width: 440px; margin: 24px auto; }
.cabeca-pagina { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.cabeca-pagina h1 { margin: 0; }

/* ---------- formularios ---------- */
label { display: block; font-weight: 600; font-size: .9rem; margin: 12px 0 4px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number],
input[type=url], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; font: inherit; background: #fff; color: var(--texto);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--azul); }
textarea { min-height: 90px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: auto; }
.senha-wrap { position: relative; }
.senha-wrap input { padding-right: 46px; }
.olho { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: 0; padding: 6px 8px; color: var(--suave); cursor: pointer; border-radius: 6px; }
.olho:hover { color: var(--azul); background: var(--azul-claro); }
.olho .olho-risco { display: none; }
.olho.visivel .olho-risco { display: inline; }
.grade-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.acoes-form { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.ajuda { font-size: .82rem; color: var(--suave); margin: 4px 0 0; }

/* ---------- botoes ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important; line-height: 1.2; white-space: nowrap; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primario { background: var(--azul); color: #fff; }
.btn-primario:hover:not(:disabled) { background: var(--azul-esc); }
.btn-verde { background: var(--verde); color: #fff; }
.btn-verde:hover:not(:disabled) { background: #15803d; }
.btn-laranja { background: var(--laranja); color: #fff; }
.btn-laranja:hover { background: #c2410c; }
.btn-linha { background: #fff; color: var(--texto); border-color: #d1d5db; }
.btn-linha:hover { border-color: var(--azul); color: var(--azul); }
.btn-perigo { background: #fff; color: var(--vermelho); border-color: #fecaca; }
.btn-perigo:hover { background: #fef2f2; }
.btn-peq { padding: 6px 12px; font-size: .88rem; }
.btn-bloco { width: 100%; }

/* ---------- alertas / badges ---------- */
.alerta { padding: 12px 16px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.alerta-sucesso { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.alerta-erro { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alerta-info { background: var(--azul-claro); border-color: #bfdbfe; color: #1e40af; }
.alerta-aviso { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: .78rem; font-weight: 600; background: #f3f4f6; color: #374151; white-space: nowrap; }
.badge-aguardando_pix { background: #fef3c7; color: #92400e; }
.badge-pago { background: #dcfce7; color: #166534; }
.badge-em_producao { background: #e0e7ff; color: #3730a3; }
.badge-enviado { background: #dbeafe; color: #1e40af; }
.badge-entregue { background: #d1fae5; color: #065f46; }
.badge-cancelado { background: #fee2e2; color: #991b1b; }

/* ---------- tabelas ---------- */
.tabela-wrap { overflow-x: auto; }
table.tabela { width: 100%; border-collapse: collapse; background: #fff; }
.tabela th, .tabela td { padding: 10px 12px; border-bottom: 1px solid var(--borda); text-align: left; vertical-align: middle; }
.tabela th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--suave); background: #fafafa; }
.tabela tr:last-child td { border-bottom: 0; }
.tabela .num { text-align: right; white-space: nowrap; }
.tabela img.mini { width: 64px; height: 64px; object-fit: contain; background: #f3f4f6; border-radius: 6px; }
.acoes { display: flex; gap: 6px; flex-wrap: wrap; }
.acoes form { margin: 0; }

/* ---------- grades/cartoes ---------- */
.grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.card-arte { background: #fff; border: 1px solid var(--borda); border-radius: var(--raio); overflow: hidden; box-shadow: var(--sombra); display: flex; flex-direction: column; }
.card-arte .img { aspect-ratio: 1; background: #eef1f6; display: flex; align-items: center; justify-content: center; }
.card-arte .img img { width: 100%; height: 100%; object-fit: contain; }
.card-arte .corpo { padding: 12px 14px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.card-arte .acoes { margin-top: auto; }
.uso-limite { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.barra { flex: 1; min-width: 160px; height: 10px; background: #e5e7eb; border-radius: 99px; overflow: hidden; }
.barra span { display: block; height: 100%; background: var(--azul); }
.metricas { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 20px; }
.metrica { background: #fff; border: 1px solid var(--borda); border-radius: var(--raio); padding: 16px; box-shadow: var(--sombra); }
a.metrica { color: inherit; display: block; text-decoration: none; }
a.metrica:hover { border-color: var(--azul); }
.metrica .valor { font-size: 1.7rem; font-weight: 700; }
.metrica .rotulo { color: var(--suave); font-size: .88rem; }
.vazio { text-align: center; padding: 48px 16px; color: var(--suave); }

/* ---------- planos ---------- */
.planos { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }
.plano { background: #fff; border: 2px solid var(--borda); border-radius: 14px; padding: 24px; text-align: center; display: flex; flex-direction: column; gap: 10px; }
.plano.destaque { border-color: var(--azul); }
.plano .preco { font-size: 2rem; font-weight: 800; color: var(--azul); }
.plano .preco small { font-size: .9rem; font-weight: 500; }
.plano ul { list-style: none; padding: 0; margin: 0; text-align: left; }
.plano li { padding: 6px 0; border-bottom: 1px dashed var(--borda); }
.plano li::before { content: "\2713  "; color: var(--verde); font-weight: 700; }
.plano form { margin-top: auto; }

/* ---------- ofertas ---------- */
.ofertas { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.oferta { background: #fff; border-radius: 14px; overflow: hidden; border: 1px solid var(--borda); box-shadow: var(--sombra); display: flex; flex-direction: column; }
.oferta .foto { position: relative; aspect-ratio: 16/10; background: linear-gradient(135deg, #dbeafe, #eff6ff); display: flex; align-items: center; justify-content: center; }
.oferta .foto img { width: 100%; height: 100%; object-fit: cover; }
.oferta .foto .sem-foto { width: 40%; opacity: .9; }
.oferta .desconto { position: absolute; top: 12px; left: 12px; background: var(--laranja); color: #fff; font-weight: 800; font-size: 1.25rem; padding: 6px 12px; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.oferta .corpo { padding: 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.oferta .precos { display: flex; align-items: baseline; gap: 10px; }
.oferta .de { color: var(--suave); text-decoration: line-through; }
.oferta .por { font-size: 1.7rem; font-weight: 800; color: var(--verde); }
.oferta .info { display: flex; justify-content: space-between; gap: 8px; font-size: .88rem; color: var(--suave); flex-wrap: wrap; }
.contagem { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--vermelho); }
.oferta .btn { margin-top: auto; }

/* ---------- confirmacao ---------- */
.confirmacao { text-align: center; max-width: 560px; margin: 24px auto; }
.confirmacao .icone { width: 72px; height: 72px; border-radius: 50%; background: #dcfce7; color: var(--verde); display: inline-flex; align-items: center; justify-content: center; font-size: 2.4rem; margin-bottom: 8px; }
.resumo { text-align: left; margin: 16px 0; }
.resumo div { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--borda); }
.resumo .total { font-weight: 800; font-size: 1.15rem; border-bottom: 0; }

/* ---------- carrinho ---------- */
.qtd { width: 84px !important; text-align: center; }
.totais { max-width: 360px; margin-left: auto; margin-top: 16px; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: none; align-items: center; justify-content: center; z-index: 200; padding: 16px; }
.modal.aberto { display: flex; }
.modal-caixa { background: #fff; border-radius: 14px; padding: 24px; max-width: 440px; width: 100%; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal-caixa h3 { margin-bottom: 8px; }
.modal-acoes { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; justify-content: flex-end; }

/* =============================== EDITOR =============================== */
body.pg-editor main { max-width: none; padding: 0; }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 380px; height: calc(100vh - 61px); min-height: 560px; }
.cena { position: relative; background: #eef1f6; overflow: hidden; }
.cena canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.cena canvas:active { cursor: grabbing; }
.cena-ferramentas { position: absolute; left: 16px; bottom: 16px; display: flex; gap: 8px; }
.cena-ferramentas button { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--borda); background: #fff; font-size: 1.3rem; font-weight: 700; cursor: pointer; box-shadow: var(--sombra); color: var(--texto); }
.cena-ferramentas button:hover { color: var(--azul); }
.cena-dica { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); background: rgba(255,255,255,.9); padding: 6px 14px; border-radius: 99px; font-size: .82rem; color: var(--suave); pointer-events: none; white-space: nowrap; }
.cena-carregando { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--suave); }
.banner-oferta { position: absolute; top: 14px; right: 14px; left: auto; background: var(--laranja); color: #fff; padding: 8px 14px; border-radius: 10px; font-weight: 600; box-shadow: var(--sombra); max-width: 60%; }
.painel { background: #fff; border-left: 1px solid var(--borda); display: flex; flex-direction: column; overflow-y: auto; }
.painel-cab { padding: 16px 18px 0; }
.painel-cab h2 { margin: 0 0 12px; font-size: 1.15rem; }
.abas { display: flex; border-bottom: 1px solid var(--borda); padding: 0 18px; gap: 4px; }
.abas button { flex: 1; background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 6px; font: inherit; font-weight: 600; color: var(--suave); cursor: pointer; }
.abas button.ativa { color: var(--azul); border-bottom-color: var(--azul); }
.painel-corpo { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.area-impressao-wrap { position: relative; background: repeating-conic-gradient(#f3f4f6 0% 25%, #fff 0% 50%) 50% / 16px 16px; border: 1px solid var(--borda); border-radius: 8px; }
.area-impressao-wrap canvas { width: 100%; display: block; touch-action: none; border-radius: 8px; }
.area-legenda { display: flex; justify-content: space-between; font-size: .78rem; color: var(--suave); margin-top: 4px; }
.controles { display: grid; grid-template-columns: auto 1fr auto; gap: 6px 10px; align-items: center; font-size: .88rem; }
.controles label { margin: 0; font-weight: 500; }
.controles input[type=range] { width: 100%; }
.controles output { min-width: 44px; text-align: right; color: var(--suave); font-variant-numeric: tabular-nums; }
.linha-botoes { display: flex; gap: 8px; flex-wrap: wrap; }
.linha-botoes .btn { flex: 1; }
.cores { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cor-campo { display: flex; align-items: center; gap: 8px; border: 1px solid var(--borda); border-radius: 8px; padding: 6px 10px; }
.cor-campo input[type=color] { width: 34px; height: 30px; border: 0; padding: 0; background: none; cursor: pointer; }
.cor-campo span { font-size: .85rem; font-weight: 500; }
.amostras { display: flex; gap: 6px; flex-wrap: wrap; }
.amostras button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--borda); cursor: pointer; }
.painel-rodape { margin-top: auto; padding: 16px 18px; border-top: 1px solid var(--borda); display: flex; flex-direction: column; gap: 8px; background: #fafafa; }
.titulo-arte input { font-weight: 600; }
.lista-camadas { display: flex; gap: 6px; flex-wrap: wrap; }
.lista-camadas button { width: 44px; height: 44px; border-radius: 6px; border: 2px solid var(--borda); padding: 0; background: #f3f4f6 center/cover no-repeat; cursor: pointer; }
.lista-camadas button.sel { border-color: var(--azul); }
.oculto { display: none !important; }
.aviso-limite a { font-weight: 700; }

@media (max-width: 900px) {
  .editor { grid-template-columns: 1fr; height: auto; }
  .cena { height: 58vh; min-height: 340px; }
  .painel { border-left: 0; border-top: 1px solid var(--borda); }
  .cena-dica { font-size: .75rem; }
  .banner-oferta { top: 48px; right: 16px; left: 16px; max-width: none; font-size: .85rem; text-align: center; }
  .cena-vistas button { padding: 7px 12px; }
}

/* botoes de vista (girar para frente / verso) */
.cena-vistas { position: absolute; right: 16px; bottom: 16px; display: flex; background: #fff; border: 1px solid var(--borda); border-radius: 99px; padding: 3px; box-shadow: var(--sombra); }
.cena-vistas button { border: 0; background: none; padding: 8px 16px; border-radius: 99px; font: inherit; font-weight: 600; color: var(--suave); cursor: pointer; }
.cena-vistas button.ativa { background: var(--azul); color: #fff; }
