:root {
  --bg: #f6f4ef;
  --ink: #1c2b25;
  --muted: #5f6f68;
  --line: #dcd7cc;
  --card: #fff;
  --brand: #1f7a5c;
  --brand-dark: #14543f;
  --danger: #a33;
  --ad-bg: #fff6e0;
  --ad-line: #e6b566;
  --ad-ink: #8a5a12;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 40, 32, .08), 0 8px 24px rgba(20, 40, 32, .06);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
}

a { color: var(--brand-dark); }

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 8px 14px; background: #fff;
  border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
  position: relative; z-index: 1100;
  flex-wrap: wrap;
}
.brand { text-decoration: none; color: var(--ink); font-size: 17px; }
.brand-pin { color: var(--brand); }
.nav { display: flex; align-items: center; gap: 14px; font-size: 15px; flex-wrap: wrap; flex: 0 0 auto; }
.nav a { text-decoration: none; color: var(--muted); }
.nav a:hover { color: var(--ink); }
.inline { display: inline; margin: 0; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; cursor: pointer; }
.linkbtn:hover { color: var(--ink); }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; background: var(--brand); color: #fff !important;
  padding: 9px 16px; border: 1px solid var(--brand); border-radius: 999px;
  text-decoration: none; font-weight: 600; cursor: pointer; font: inherit;
  transition: background .15s;
}
.btn:hover { background: var(--brand-dark); }
.btn-sm { padding: 6px 12px; font-size: 14px; }
.btn.ghost { background: transparent; color: var(--brand-dark) !important; }
.btn.ghost:hover { background: rgba(31,122,92,.08); }

/* ---------- layout ---------- */
.page { flex: 1; display: flex; min-height: 0; align-items: stretch; }
.container { width: 100%; max-width: 980px; margin: 24px auto; padding: 0 16px; flex: 1; min-width: 0; }
.fullmap { flex: 1; display: flex; position: relative; min-height: 65vh; min-width: 0; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px;
}
.card.narrow { max-width: 460px; margin: 0 auto; }
.card h1 { margin: 0 0 12px; font-size: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 14px; margin-top: -4px; }

/* ---------- forms ---------- */
.fields { display: grid; gap: 14px; margin: 16px 0; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 14px; font-weight: 600; }
.field small { color: var(--muted); font-size: 12px; }
.field .err { color: var(--danger); }
input[type=text], input[type=email], input[type=password], input[type=url],
input[type=tel], input[type=number], input[type=search], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 9px; background: #fff; color: var(--ink); font: inherit;
}
input:focus, textarea:focus, select:focus { outline: 2px solid rgba(31,122,92,.35); border-color: var(--brand); }
.field.bad input, .field.bad textarea, .field.bad select { border-color: var(--danger); }
input[type=checkbox] { width: auto; }

/* ---------- messages ---------- */
.messages { padding: 8px 16px; }
.msg { padding: 10px 14px; border-radius: 9px; margin-bottom: 6px; font-size: 14px; background: #e8f3ee; border: 1px solid #bfdccf; }
.msg.error { background: #fdeaea; border-color: #f0bcbc; color: #7a2020; }

/* ---------- map ---------- */
.map { width: 100%; height: 100%; min-height: 320px; background: #dfe6e1; }
.detail-map { height: 320px; border-radius: var(--radius); margin-top: 18px; }
.pick-map { height: 300px; border-radius: var(--radius); margin-bottom: 6px; }
.pin-wrap { width: 18px; height: 18px; }
.pin {
  display: block; width: 18px; height: 18px; border-radius: 50% 50% 50% 0;
  background: var(--c); border: 2px solid #fff; box-shadow: 0 2px 5px rgba(0,0,0,.35);
  transform: rotate(-45deg);
}

/* ---------- home ---------- */
.sidebar {
  width: 340px; flex: 0 0 340px; background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; z-index: 1000; max-height: 100%;
}
.sidebar-head { padding: 14px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.sidebar-head small { color: var(--muted); font-size: 12px; }
/* categorias quebram em linhas: nada fica escondido na horizontal */
.chips {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px;
  border-bottom: 1px solid var(--line); max-height: 34vh; overflow-y: auto;
}
.chip {
  white-space: nowrap; padding: 5px 11px; border-radius: 999px; font-size: 12.5px;
  border: 1px solid var(--line); background: #fff; color: var(--muted); cursor: pointer; font-family: inherit;
}
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
/* tag chips: dashed border = free-form labels, not curated categories */
/* single scrollable row: tags must not eat the results list height */
.chips-tags {
  border-top: 0; padding-top: 0; max-height: none;
  flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch; scrollbar-width: thin;
}
.chips-tags::-webkit-scrollbar { height: 4px; }
.chips-tags::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.chip-tag { background: #f7f8f6; border-style: dashed; font-size: 12px; }
.chip-tag.active {
  background: var(--brand-dark); border-style: solid; border-color: var(--brand-dark); color: #fff;
}
.chip-tag i { font-style: normal; opacity: .65; margin-left: 5px; font-size: 11px; }
.li-tags { display: block; font-style: normal; font-size: 11.5px; color: var(--brand-dark); }
.popup-tags { margin: 4px 0; }
.popup-tags span {
  display: inline-block; background: rgba(31,122,92,.12); color: var(--brand-dark);
  border-radius: 999px; padding: 1px 8px; font-size: 11px; margin: 0 4px 4px 0;
}
a.tag.tag-link { text-decoration: none; margin-right: 4px; }
a.tag.tag-link:hover { background: rgba(31,122,92,.25); }
.results { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.results li { border-bottom: 1px solid var(--line); }
.results li a {
  display: grid; gap: 2px; padding: 12px 14px; text-decoration: none; color: var(--ink);
}
.results li a:hover { background: #f0f6f3; }
.results li a span { font-size: 13px; color: var(--brand-dark); }
.results li a small { color: var(--muted); font-size: 13px; }
.results .empty { padding: 16px; color: var(--muted); font-size: 14px; }

/* ---------- cidades ---------- */
.city-select {
  background: #ffffff14; color: inherit; border: 1px solid #ffffff33;
  border-radius: 8px; padding: 6px 8px; font: inherit; font-size: .9rem;
  max-width: 190px; text-overflow: ellipsis;
}
.city-select option { color: #111; }
.city-search {
  width: 100%; margin-top: 14px; padding: 10px 12px; font: inherit;
  border: 1px solid var(--line); border-radius: var(--radius);
}
.city-list {
  list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.city-list a.empty-city { opacity: .62; }
.city-list a {
  display: flex; align-items: baseline; gap: 8px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none;
  background: #fff;
}
.city-list a:hover { border-color: var(--brand); }
.city-list small { margin-left: auto; color: var(--muted); }

/* ---------- reivindicacao de negocio ---------- */
.claim-box {
  margin-top: 18px; padding: 14px 16px; border-radius: var(--radius);
  background: #f0f7f4; border: 1px solid #bcdcd0;
}
.claim-box p { margin: 0 0 10px; }

/* ---------- painel ---------- */
.card h2 { font-size: 18px; margin: 0; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.kv > div {
  background: #f8faf9; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; display: grid; gap: 2px;
}
.kv span { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.field.check { flex-direction: column; gap: 4px; }
.check-label { display: flex; align-items: center; gap: 8px; font-weight: 500; }

/* ---------- detail / dashboard ---------- */
.detail h1 { margin-bottom: 6px; }
.tag {
  display: inline-block; background: rgba(31,122,92,.12); color: var(--brand-dark);
  border-radius: 999px; padding: 3px 10px; font-size: 13px; margin-bottom: 10px;
}
.tag.warn { background: #fbeedb; color: #8a5a12; }
.detail-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; }
.detail-grid h3 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 0 6px; }
.desc { margin: 0; }
.logo { max-width: 180px; border-radius: 10px; display: block; margin-bottom: 12px; }
.contact p { margin: 6px 0; }
.biz-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.biz-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; flex-wrap: wrap;
}
.biz-list small { display: block; color: var(--muted); font-size: 13px; }
.actions { display: flex; gap: 8px; }
.ok { color: var(--brand-dark); }
.warn { color: #8a5a12; }
.empty { color: var(--muted); }

/* ---------- anuncios ---------- */
/* cor diferente de proposito: deixa obvio que ali e inventario publicitario */
.ad-slot {
  position: relative; display: grid; place-content: center; gap: 3px;
  text-align: center; padding: 14px;
  background: var(--ad-bg); border: 2px dashed var(--ad-line);
  border-radius: var(--radius); color: var(--ad-ink);
}
.ad-slot .ad-tag {
  position: absolute; top: 7px; left: 10px; font-size: 10px; letter-spacing: .09em;
  text-transform: uppercase; opacity: .7;
}
.ad-slot .ad-title { font-weight: 700; font-size: 15px; }
.ad-slot .ad-size { font-size: 12px; opacity: .8; font-variant-numeric: tabular-nums; }
.ad-slot:hover { border-color: var(--ad-ink); }

/* banner no meio do header: mesma linha da marca e do menu, sem empurrar a barra */
.ad-header-leader {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  flex: 1 1 auto; min-width: 0; max-width: 720px; margin: 0 16px;
  min-height: 90px; padding: 5px 12px; text-align: left;
}
.ad-header-leader .ad-tag { position: static; }
.ad-header-leader .ad-title { font-size: 13px; }
.ad-header-leader .ad-size { font-size: 11px; opacity: .7; }
.topbar .nav { flex: 0 0 auto; }

.ad-rail { width: 200px; flex: 0 0 200px; padding: 14px 14px 14px 0; align-self: flex-start; position: sticky; top: 12px; }
.ad-skyscraper { min-height: 600px; max-height: 600px; }

.footer-ads { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ad-footer-leader { min-height: 90px; width: 100%; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); background: #fff; }
.footer-ads { padding: 12px 16px; }
.footer-bottom {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; font-size: 12px; color: var(--muted);
  border-top: 1px solid var(--line);
}
.footer-links { display: flex; gap: 14px; }
.footer-links a { text-decoration: none; color: var(--muted); }
.footer-links a:hover { color: var(--ink); }

@media (max-width: 1100px) {
  .ad-rail { display: none; }
}

@media (max-width: 760px) {
  .fullmap { min-height: 0; }
  .ad-header-leader { flex: 1 0 100%; max-width: none; margin: 6px 0 0; min-height: 54px; }
  .footer-ads { grid-template-columns: 1fr; }
  .ad-footer-leader { min-height: 70px; }
  .fullmap { flex-direction: column-reverse; }
  .sidebar { width: 100%; flex: 0 0 auto; max-height: 45vh; border-right: 0; border-top: 1px solid var(--line); }
  .map { min-height: 55vh; }
  .detail-grid { grid-template-columns: 1fr; gap: 8px; }
  .container { margin: 14px auto; }
}
