/* FARO — visual portado do referencia-radar.html + peças novas (kit no header, banner de login, modal, paywall) */
:root {
  --azul: #1d4ed8; --laranja: #ea580c; --cinza: #64748b;
  --verde: #16a34a; --vermelho: #dc2626; --fundo: #f4f6f9;
  --card: #ffffff; --borda: #e2e8f0; --texto: #0f172a; --texto2: #55657a;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--fundo); color: var(--texto); display: flex; flex-direction: column; }

/* ---------- header ---------- */
header { position: relative; background: #0f172a; color: #fff; padding: 10px 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; z-index: 1200; }
header h1 { font-size: 17px; font-weight: 800; letter-spacing: .3px; white-space: nowrap; }
header .sub { font-size: 11px; color: #94a3b8; }
#selKit { flex: 1 1 150px; min-width: 0; max-width: 300px; background: #1e293b; color: #fff; border: 1px solid #334155; border-radius: 8px; padding: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }
#contador { background: var(--azul); color: #fff; font-weight: 700; font-size: 13px; padding: 5px 12px; border-radius: 999px; white-space: nowrap; }
#contaWrap { display: flex; align-items: center; margin-left: auto; }
#btnConta { background: var(--azul); border: 1px solid var(--azul); color: #fff; border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 700; cursor: pointer; }

/* peças que o auth.js monta no header */
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--azul); color: #fff; font-weight: 800; font-size: 15px; display: flex; align-items: center; justify-content: center; border: 2px solid #334155; cursor: pointer; text-transform: uppercase; }
.menu-conta { position: absolute; right: 10px; top: calc(100% + 6px); background: #fff; color: var(--texto); border: 1px solid var(--borda); border-radius: 10px; box-shadow: 0 12px 32px rgba(15,23,42,.2); padding: 8px; z-index: 1500; min-width: 210px; }
.menu-conta .quem { font-size: 12px; color: var(--texto2); padding: 6px 10px; border-bottom: 1px solid var(--borda); margin-bottom: 4px; word-break: break-all; }
.menu-conta button { width: 100%; text-align: left; border: none; background: none; padding: 9px 10px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--texto); cursor: pointer; }
.menu-conta button:hover { background: #f1f5f9; }

/* ---------- banner "entre pra salvar" ---------- */
#banner-login { background: #dbeafe; color: #1e3a8a; padding: 8px 14px; font-size: 13px; display: flex; gap: 10px; align-items: center; border-bottom: 1px solid #bfdbfe; }
#banner-login[hidden] { display: none; }
#banner-login span { flex: 1; min-width: 0; }
#banner-login button.primario { padding: 6px 14px; font-size: 12.5px; }
#banner-login .fechar { background: none; border: none; color: #1e3a8a; font-size: 14px; padding: 4px 6px; cursor: pointer; }

/* ---------- layout ---------- */
#app { flex: 1; display: flex; min-height: 0; }
#painel { width: 400px; max-width: 100%; display: flex; flex-direction: column; background: var(--fundo); border-right: 1px solid var(--borda); }
#mapa { flex: 1; min-height: 0; background: #dbe3ec; }

#controles { padding: 10px 12px; background: var(--card); border-bottom: 1px solid var(--borda); display: flex; flex-direction: column; gap: 8px; }
.linha { display: flex; gap: 6px; align-items: center; }
.linha input[type=text] { flex: 1; padding: 9px 10px; border: 1px solid var(--borda); border-radius: 8px; font-size: 14px; min-width: 0; }
button { cursor: pointer; border: 1px solid var(--borda); background: #fff; border-radius: 8px; padding: 8px 10px; font-size: 13px; font-weight: 600; color: var(--texto); font-family: inherit; }
button:active { transform: scale(.97); }
button.primario { background: var(--azul); border-color: var(--azul); color: #fff; }
#btnGeo { white-space: nowrap; }

#raioLinha { display: flex; align-items: center; gap: 10px; }
#raioLinha input[type=range] { flex: 1; accent-color: var(--azul); }
#raioVal { font-weight: 800; font-size: 15px; min-width: 64px; text-align: right; color: var(--azul); }

.chips { display: flex; gap: 5px; flex-wrap: wrap; }
.chip { font-size: 11.5px; font-weight: 700; padding: 5px 9px; border-radius: 999px; border: 1.5px solid var(--borda); background: #fff; color: var(--texto2); cursor: pointer; user-select: none; }
.chip.on { color: #fff; background: #0f172a; border-color: #0f172a; }

/* ---------- lista ---------- */
#lista { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.item { background: var(--card); border: 1px solid var(--borda); border-radius: 10px; padding: 10px 12px; }
.item.visitado { border-left: 4px solid var(--verde); }
.item.descartado { opacity: .45; }
.item .topo { display: flex; align-items: baseline; gap: 8px; }
.item .dist { font-size: 13px; font-weight: 800; color: var(--azul); white-space: nowrap; }
.item .nome { font-size: 14px; font-weight: 700; line-height: 1.25; }
.item .fant { color: var(--texto2); font-weight: 500; font-size: 12px; }
.item .meta { font-size: 12px; color: var(--texto2); margin-top: 3px; }
.item .tags { display: flex; gap: 4px; margin-top: 5px; flex-wrap: wrap; }
.tag { font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 4px; letter-spacing: .3px; }
.tag.seg { background: #e2e8f0; color: #475569; } /* cor real vem inline, por grupo de CNAE */
.tag.mg { background: #dcfce7; color: #166534; }
.tag.fil { background: #fef9c3; color: #854d0e; }
.tag.prec { background: #fee2e2; color: #991b1b; }
.item .acoes { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.acoes a, .acoes button { text-decoration: none; font-size: 12.5px; font-weight: 700; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--borda); background: #f8fafc; color: var(--texto); }
.acoes a.tel { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.acoes a.zap { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.acoes button.ck.on { background: var(--verde); border-color: var(--verde); color: #fff; }
.acoes button.x.on { background: var(--vermelho); border-color: var(--vermelho); color: #fff; }
.acoes button.primario { background: var(--azul); border-color: var(--azul); color: #fff; }
.item textarea { width: 100%; margin-top: 7px; border: 1px dashed var(--borda); border-radius: 8px; padding: 6px 8px; font-size: 12.5px; font-family: inherit; resize: vertical; min-height: 30px; display: none; }
.item textarea.aberta, .item textarea.tem { display: block; }

/* estados especiais da lista */
.item.aviso { color: var(--texto2); font-size: 13px; }
.item.paywall-faixa { border: 1.5px solid #bfdbfe; background: #eff6ff; font-size: 13px; }
.item.paywall-faixa b { color: var(--azul); }

#rodape { padding: 8px 12px; background: var(--card); border-top: 1px solid var(--borda); display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--texto2); }
#rodape button { font-size: 12px; padding: 6px 10px; }

/* ---------- popup do mapa ---------- */
.leaflet-popup-content { font-family: inherit; font-size: 13px; margin: 10px 12px; }
.leaflet-popup-content b { font-size: 13.5px; }
.pop-acoes { display: flex; gap: 6px; margin-top: 8px; }
.pop-acoes a { text-decoration: none; font-weight: 700; font-size: 12px; padding: 5px 9px; border-radius: 7px; background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ---------- modal (login do auth.js / planos do paywall.js) ---------- */
.modal-fundo { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center; z-index: 2000; padding: 16px; }
.modal { position: relative; background: #fff; border-radius: 14px; padding: 20px; width: 100%; max-width: 400px; box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.modal h2 { font-size: 17px; margin-bottom: 4px; }
.modal p { font-size: 13px; color: var(--texto2); margin-bottom: 12px; }
.modal input[type=email], .modal input[type=text], .modal input[type=tel], .modal input[type=number] { width: 100%; padding: 10px 12px; border: 1px solid var(--borda); border-radius: 8px; font-size: 15px; margin: 6px 0; }
.modal .acoes-modal { display: flex; gap: 8px; margin-top: 12px; }
.modal .acoes-modal button { flex: 1; padding: 10px; font-size: 14px; }
.modal .fechar { position: absolute; top: 10px; right: 10px; border: none; background: none; font-size: 15px; color: var(--texto2); padding: 6px; cursor: pointer; }
.modal .erro { color: var(--vermelho); font-size: 12.5px; margin-top: 6px; }

/* planos do paywall */
.planos { display: flex; gap: 10px; margin: 12px 0; }
.plano { flex: 1; border: 1.5px solid var(--borda); border-radius: 12px; padding: 14px 12px; text-align: center; cursor: pointer; background: #fff; }
.plano:hover, .plano.escolhido { border-color: var(--azul); background: #eff6ff; }
.plano .preco { font-size: 20px; font-weight: 800; color: var(--azul); }
.plano .periodo { font-size: 11.5px; color: var(--texto2); font-weight: 700; }
.plano .selo { display: inline-block; margin-top: 6px; font-size: 10px; font-weight: 800; background: #dcfce7; color: #166534; padding: 2px 8px; border-radius: 999px; }

/* toast (ex.: "Bem-vindo ao PRO 🎉") */
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #0f172a; color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 700; font-size: 13.5px; z-index: 3000; box-shadow: 0 10px 30px rgba(0,0,0,.35); }

/* ---------- mobile: página inteira rola (scroll nativo), nada de janelinha interna ---------- */
@media (max-width: 820px) {
  html, body { height: auto; }
  body { display: block; }
  header { position: sticky; top: 0; }
  #app { flex-direction: column-reverse; }
  #painel { width: 100%; flex: none; border-right: 0; }
  #lista { flex: none; overflow: visible; }
  #mapa { height: 38vh; flex: none; }
  #controles { position: static; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { white-space: nowrap; flex: none; }
  #rodape { position: static; }
  header h1 { font-size: 15px; }
  header .sub { display: none; }
  #selKit { order: 5; flex: 1 1 100%; max-width: none; }
  .planos { flex-direction: column; }
}
