/* ============================================================================
   LOCALEAD: prospecção de leads locais.
   Identidade "raio de alcance": o gesto do produto é cravar um pino num ponto
   e achar todo negócio ao redor. A marca desenha isso: pino com anéis de
   alcance sobre a malha de quarteirões, na linguagem de placas de rua.
   Verde-sinal é a única cor de ação; ember (o laranja dos marcadores) só
   aparece falando de calor de lead. Papel claro de mapa urbano, tinta
   verde-noite, display Archivo (largura de placa), dados em mono.
   Tema claro por decisão: é uma ferramenta de trabalho diurna de vendas.
   ========================================================================== */

:root {
  color-scheme: light;

  /* superfícies */
  --bg: #eef1ea;
  --panel: #ffffff;
  --panel-2: #f4f7f0;
  --text: #16241c;
  --muted: #5b6b60;
  --border: #d9e1d3;

  /* marca */
  --primary: #0e7a4a;
  --primary-strong: #0a5d39;
  --primary-soft: #e6f3ea;
  --primary-ink: #ffffff;
  --primary-bright: #46c483; /* verde-sinal aceso, para superfícies escuras */
  --ember: #eb6834;

  /* verde-noite do sidebar / painel de marca */
  --pine-950: #07130c;
  --pine-900: #0b1b12;
  --pine-800: #14301f;
  --pine-line: rgba(190, 214, 199, 0.14);
  --pine-ink: #b9cec0;
  --pine-ink-strong: #eef7f0;

  /* calor de lead e qualidade (mesmos valores do globo, validados lá) */
  --heat-cold: #3b6fc4;
  --heat-cold-on-panel: #3b6fc4;
  --heat-warm: #f0a33c;
  --heat-warm-on-panel: #9d5602;
  --heat-hot: #c1360a;
  --heat-hot-on-panel: #c1360a;
  --quality-good: #0b6b67;
  --quality-mid: #985802;
  --quality-bad: #942024;

  --ok: #0b6b67;
  --danger: #b3261e;

  --shadow: 0 1px 2px rgba(18, 32, 24, 0.05), 0 4px 16px rgba(18, 32, 24, 0.06);
  --shadow-lift: 0 2px 4px rgba(18, 32, 24, 0.06), 0 10px 28px rgba(18, 32, 24, 0.1);
  --radius: 12px;
  --pill-h: 24px;

  --font-ui: 'Archivo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Archivo', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }
/* display:flex/grid nas telas venceria o [hidden] nativo; aqui ele vence sempre. */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
html { height: 100%; }
body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-stretch: 112%; letter-spacing: -0.015em; margin: 0; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; }
svg { display: block; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------------------------------------------------------------- botões */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.06s, box-shadow 0.15s;
}
.btn:hover { background: var(--panel-2); border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: var(--primary-strong); border-color: var(--primary-strong); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 11px; font-size: 0.85rem; border-radius: 8px; }
.btn.lg { padding: 12px 20px; font-size: 1rem; border-radius: 12px; }
.btn.block { width: 100%; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 7%, var(--panel)); }
.btn:disabled { opacity: 0.55; cursor: default; pointer-events: none; }
.btn .ico { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.link { font-weight: 600; font-size: 0.88rem; }

/* -------------------------------------------------------------- formulários */
label { display: block; font-weight: 600; font-size: 0.88rem; color: var(--text); }
label .opt { color: var(--muted); font-weight: 500; }
label input, label select, label textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
label input:focus, label select:focus, label textarea:focus,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}
.form-hint { color: var(--muted); font-size: 0.9rem; }
.form-stack { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; align-items: flex-start; }
.form-stack label { width: 100%; }

/* ------------------------------------------------------------------- marca */
.brand-lockup { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  /* a placa: pino com anéis de alcance sobre a malha de quarteirões */
  width: 30px; height: 30px; border-radius: 30%;
  background:
    radial-gradient(circle at 50% 44%, #fff 0 3.5px, transparent 4.2px),
    radial-gradient(circle at 50% 44%, transparent 0 6.5px, rgba(255, 255, 255, 0.85) 7px 8.4px, transparent 9px),
    radial-gradient(circle at 50% 44%, transparent 0 11px, rgba(255, 255, 255, 0.32) 11.5px 12.6px, transparent 13.4px),
    linear-gradient(135deg, #1a9b62 0%, #0e7a4a 52%, #07553a 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), inset 0 -6px 12px rgba(4, 30, 18, 0.35);
  position: relative;
  flex-shrink: 0;
}
.brand-mark::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(to right, transparent calc(28% - 0.5px), rgba(255, 255, 255, 0.13) 0 calc(28% + 0.5px), transparent 0),
    linear-gradient(to right, transparent calc(72% - 0.5px), rgba(255, 255, 255, 0.13) 0 calc(72% + 0.5px), transparent 0),
    linear-gradient(to bottom, transparent calc(30% - 0.5px), rgba(255, 255, 255, 0.11) 0 calc(30% + 0.5px), transparent 0),
    linear-gradient(to bottom, transparent calc(74% - 0.5px), rgba(255, 255, 255, 0.11) 0 calc(74% + 0.5px), transparent 0);
}
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; font-stretch: 125%; letter-spacing: 0.02em; }
.brand-name b { font-weight: inherit; color: var(--primary); }
.auth-brand .brand-name b, .sidebar .brand-name b, .mobile-topbar .brand-name b { color: var(--primary-bright); }

/* ============================================================== AUTENTICAÇÃO */
.auth { display: grid; grid-template-columns: minmax(380px, 1.05fr) minmax(360px, 1fr); min-height: 100vh; }
.auth-brand {
  background:
    radial-gradient(120% 90% at 20% 8%, rgba(70, 196, 131, 0.16) 0%, transparent 55%),
    radial-gradient(ellipse 130% 90% at 85% 100%, rgba(235, 104, 52, 0.1) 0%, transparent 50%),
    linear-gradient(160deg, var(--pine-900), var(--pine-950));
  color: var(--pine-ink);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px 56px 28px;
  position: relative;
  overflow: hidden;
}
.auth-brand::before {
  /* malha de quarteirões e uma avenida diagonal: a assinatura urbana sem gritar */
  content: "";
  position: absolute; inset: -20%;
  background-image:
    linear-gradient(58deg, transparent calc(38% - 1px), rgba(190, 214, 199, 0.09) 0 calc(38% + 1px), transparent 0),
    repeating-linear-gradient(0deg, transparent 0 55px, rgba(190, 214, 199, 0.05) 55px 56px),
    repeating-linear-gradient(90deg, transparent 0 76px, rgba(190, 214, 199, 0.05) 76px 77px);
  pointer-events: none;
}
.auth-brand .brand-name { color: var(--pine-ink-strong); }
.auth-brand-inner { position: relative; max-width: 520px; }
.auth-title { color: var(--pine-ink-strong); font-size: clamp(1.9rem, 3.2vw, 2.6rem); line-height: 1.12; margin-top: 64px; font-weight: 700; }
.auth-sub { margin-top: 18px; font-size: 1.02rem; max-width: 44ch; }
.auth-points { list-style: none; margin: 28px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.auth-points li { padding-left: 28px; position: relative; }
.auth-points li::before {
  content: ""; position: absolute; left: 2px; top: 7px;
  width: 12px; height: 7px; border-left: 2.5px solid var(--primary-bright); border-bottom: 2.5px solid var(--primary-bright);
  transform: rotate(-45deg);
}
.auth-foot { position: relative; font-size: 0.82rem; color: color-mix(in srgb, var(--pine-ink) 70%, transparent); }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-form { width: min(400px, 100%); display: flex; flex-direction: column; gap: 16px; }
.auth-form h2 { font-size: 1.7rem; }
.auth-form .btn { margin-top: 6px; }
.auth-switch { font-size: 0.92rem; color: var(--muted); text-align: center; }

/* Mobile: a marca não some, vira uma faixa curta em cima do formulário,
   e o formulário cola logo abaixo dela em vez de flutuar no meio da tela. */
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; min-height: 100dvh; }
  .auth-brand { justify-content: flex-start; padding: 22px 22px 24px; }
  .auth-title { margin-top: 14px; font-size: 1.4rem; line-height: 1.25; }
  .auth-sub { margin-top: 8px; font-size: 0.92rem; }
  .auth-points, .auth-foot { display: none; }
  .auth-panel { align-items: flex-start; padding: 34px 20px 44px; }
}

.chip-city {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--primary-soft); color: var(--primary-strong);
  border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border));
  border-radius: 999px; padding: 5px 8px 5px 14px; font-weight: 600; font-size: 0.9rem;
}
.chip-city button { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 1rem; line-height: 1; padding: 2px 5px; border-radius: 50%; }
.chip-city button:hover { background: color-mix(in srgb, var(--primary) 16%, transparent); }

/* ==================================================================== SHELL */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }

/* Topbar mobile + backdrop da gaveta: só existem em telas estreitas (o bloco
   responsivo no fim do arquivo liga os dois); no desktop não entram no grid. */
.mobile-topbar, .nav-backdrop { display: none; }
.menu-btn {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border: 0; background: none; border-radius: 10px;
  color: var(--pine-ink-strong); cursor: pointer;
  flex-shrink: 0;
}
.menu-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.menu-btn:hover, .menu-btn:active { background: var(--pine-800); }

.sidebar {
  background:
    radial-gradient(140% 60% at 0% 0%, rgba(70, 196, 131, 0.12) 0%, transparent 60%),
    linear-gradient(175deg, var(--pine-900), var(--pine-950));
  color: var(--pine-ink);
  display: flex; flex-direction: column;
  padding: 20px 14px 14px;
  position: sticky; top: 0; height: 100vh;
}
.brand-lockup.side { padding: 2px 10px 18px; }
.brand-lockup.side .brand-name { color: var(--pine-ink-strong); font-size: 1.1rem; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  color: var(--pine-ink); text-decoration: none;
  font-weight: 600; font-size: 0.93rem;
  padding: 9px 12px; border-radius: 9px;
  border-left: 2.5px solid transparent;
  transition: background 0.12s, color 0.12s;
}
.nav a svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: 0.85; }
.nav a:hover { background: var(--pine-800); color: var(--pine-ink-strong); text-decoration: none; }
.nav a.active { background: var(--pine-800); color: var(--pine-ink-strong); border-left-color: var(--primary-bright); }
.nav.quiet a { font-weight: 500; }
/* O console é outra sala: o atalho para ele usa a cor da plataforma. */
.nav a#nav-admin { color: var(--ember); }
.nav a#nav-admin:hover { color: color-mix(in srgb, var(--ember) 55%, #fff); }
.nav-sep { flex: 1; min-height: 16px; }
.side-user {
  display: flex; align-items: center; gap: 10px;
  border-top: 1px solid var(--pine-line);
  padding: 12px 6px 2px; margin-top: 12px;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #2ea36b, var(--primary-strong));
  color: #fff; font-weight: 700; font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.side-user-info { min-width: 0; display: flex; flex-direction: column; }
.side-user-name { color: var(--pine-ink-strong); font-weight: 600; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-plan { font-size: 0.76rem; color: var(--pine-ink); }
.side-logout { margin-left: auto; background: none; border: 0; color: var(--pine-ink); cursor: pointer; padding: 7px; border-radius: 8px; }
.side-logout svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.side-logout:hover { background: var(--pine-800); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }

/* Faixa de sessão de suporte: a administração dentro da conta de um cliente.
   Ember porque é a cor da plataforma, e fica grudada no topo justamente para
   não deixar ninguém esquecer de onde está falando. */
.imp-banner {
  position: sticky; top: 0; z-index: 55;
  display: flex; align-items: center; gap: 12px;
  padding: 9px 28px;
  background: color-mix(in srgb, var(--ember) 14%, var(--panel));
  border-bottom: 1px solid color-mix(in srgb, var(--ember) 40%, var(--border));
  color: color-mix(in srgb, var(--ember) 78%, #3a1200);
  font-size: 0.88rem;
}
.imp-banner svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; flex-shrink: 0; }
.imp-banner .imp-text { flex: 1; min-width: 0; }
.imp-banner .btn { flex-shrink: 0; background: var(--panel); border-color: color-mix(in srgb, var(--ember) 45%, var(--border)); color: inherit; }
.imp-banner .btn:hover { background: color-mix(in srgb, var(--ember) 10%, var(--panel)); }
@media (max-width: 860px) {
  .imp-banner { padding: 9px 16px; flex-wrap: wrap; font-size: 0.82rem; }
  .imp-banner .btn { margin-left: auto; }
}
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 22px 28px 0;
}
.topbar-title h1 { font-size: 1.5rem; font-weight: 700; }
.page-sub { color: var(--muted); font-size: 0.92rem; margin-top: 2px; }
.page-sub:empty { display: none; }
.topbar-side { display: flex; align-items: center; gap: 12px; }
.quota-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 14px 6px 8px;
  font-size: 0.86rem; font-weight: 600; color: var(--muted);
  box-shadow: var(--shadow);
}
.quota-ring {
  width: 20px; height: 20px; border-radius: 50%;
  background: conic-gradient(var(--primary) calc(var(--used, 0) * 1%), var(--panel-2) 0);
  border: 1px solid var(--border);
}
.quota-chip b { color: var(--text); font-family: var(--font-mono); font-size: 0.82rem; }

.content { padding: 18px 28px 40px; }
.view[hidden] { display: none; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h3, .card > h3 { font-size: 1.05rem; }

/* ================================================================ DASHBOARD */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1100px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px;
  display: flex; flex-direction: column; gap: 4px;
  min-height: 106px;
}
.tile-label { font-size: 0.78rem; letter-spacing: 0.09em; text-transform: uppercase; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.tile-label svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.tile-value { font-family: var(--font-display); font-weight: 800; font-size: 2rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile-note { font-size: 0.84rem; color: var(--muted); }
.tile.accent { background: linear-gradient(150deg, #1a9b62, var(--primary-strong)); border-color: var(--primary-strong); color: #fff; }
.tile.accent .tile-label, .tile.accent .tile-note { color: rgba(255, 255, 255, 0.82); }

.dash-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 14px; margin-top: 14px; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }

.funil { display: flex; flex-direction: column; gap: 10px; }
.funil-row { display: grid; grid-template-columns: 132px 1fr 46px; align-items: center; gap: 12px; }
.funil-label { font-size: 0.88rem; font-weight: 600; color: var(--text); }
.funil-bar { height: 14px; border-radius: 4px 7px 7px 4px; background: var(--panel-2); overflow: hidden; }
.funil-bar i { display: block; height: 100%; border-radius: 0 7px 7px 0; background: var(--fill, var(--primary)); min-width: 2px; transition: width 0.5s cubic-bezier(0.2, 0.9, 0.3, 1); }
.funil-n { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 600; text-align: right; }

.dash-buscas { display: flex; flex-direction: column; }
.dash-busca-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 4px; border-bottom: 1px solid var(--border);
}
.dash-busca-row:last-child { border-bottom: 0; }
.dash-busca-ico { width: 34px; height: 34px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.dash-busca-ico svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.dash-busca-info { min-width: 0; flex: 1; }
.dash-busca-title { font-weight: 600; font-size: 0.93rem; }
.dash-busca-sub { color: var(--muted); font-size: 0.82rem; }
.dash-busca-n { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 600; color: var(--primary); white-space: nowrap; }
.empty-note { color: var(--muted); padding: 18px 4px; font-size: 0.92rem; }
.empty-note a { font-weight: 600; }

/* =============================================================== NOVA BUSCA */
/* stretch: os dois cartões terminam na mesma linha, o globo dita a altura. */
.busca-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); gap: 14px; align-items: stretch; }
@media (max-width: 1000px) { .busca-layout { grid-template-columns: 1fr; } }
.busca-map { padding: 14px; }
.globe-dock { min-height: 560px; display: flex; flex-direction: column; }
.globe-dock .globe-root { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.globe-dock .globe-layout { flex: 1; min-height: 480px; }
.busca-form h3 { font-size: 1.05rem; margin-bottom: 4px; }
.busca-form { display: flex; flex-direction: column; gap: 14px; }
.busca-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.busca-place {
  border: 1.5px dashed var(--border); border-radius: 10px;
  padding: 10px 14px; background: var(--panel-2);
  min-height: 46px; display: flex; align-items: center;
}
.busca-place.locked { border-style: solid; border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); background: var(--primary-soft); }
.busca-place-empty { color: var(--muted); font-size: 0.9rem; }
.quota-note { font-size: 0.84rem; color: var(--muted); }
.busca-status {
  border-radius: 10px; padding: 12px 14px; font-size: 0.92rem; font-weight: 500;
  background: var(--primary-soft); color: var(--primary-strong);
  display: flex; align-items: center; gap: 10px;
}
.busca-status.err { background: color-mix(in srgb, var(--danger) 8%, var(--panel)); color: var(--danger); }
.busca-status.ok { background: color-mix(in srgb, var(--ok) 9%, var(--panel)); color: var(--ok); }
/* Rodapé do formulário: as últimas buscas ocupam a folga que o stretch cria,
   e um clique nelas preenche o formulário de novo. */
.busca-recent { margin-top: auto; border-top: 1px solid var(--border); padding-top: 14px; }
.busca-recent-title { display: block; font-size: 0.74rem; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.busca-recent-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  background: none; border: 0; border-radius: 9px;
  padding: 8px 10px; margin: 0 -10px; box-sizing: content-box;
  font: inherit; font-size: 0.9rem; cursor: pointer;
}
.busca-recent-row:hover { background: var(--panel-2); }
.busca-recent-row svg { width: 14px; height: 14px; stroke: var(--muted); fill: none; stroke-width: 2; stroke-linecap: round; flex-shrink: 0; }
.busca-recent-info { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.busca-recent-info small { color: var(--muted); }
.busca-recent-n { font-family: var(--font-mono); font-size: 0.8rem; font-weight: 600; color: var(--primary); white-space: nowrap; }
.spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
  border-top-color: currentColor;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ================================================================ MEUS LEADS */
.leads-card { padding: 0; overflow: hidden; }
.leads-toolbar { display: flex; gap: 10px; padding: 14px 16px 10px; flex-wrap: wrap; align-items: center; }
.leads-toolbar input[type="search"] { flex: 1 1 200px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 9px; font: inherit; }
.leads-toolbar select { padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px; font: inherit; background: var(--panel); max-width: 180px; }
.leads-toolbar-right { margin-left: auto; display: flex; gap: 8px; }
.leads-quickfilters { display: flex; gap: 8px; padding: 0 16px 12px; flex-wrap: wrap; }
.chip-filter {
  border: 1px solid var(--border); background: var(--panel);
  border-radius: 999px; padding: 5px 13px; font-size: 0.84rem; font-weight: 600;
  color: var(--muted); cursor: pointer;
  transition: all 0.12s;
}
.chip-filter:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); color: var(--text); }
.chip-filter[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-strong); }

.leads-table-wrap { overflow-x: auto; }
.leads-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.leads-table th {
  text-align: left; font-size: 0.74rem; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; padding: 10px 14px;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  background: var(--panel-2);
  white-space: nowrap;
}
.leads-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.leads-table tbody tr { cursor: pointer; transition: background 0.1s; }
.leads-table tbody tr:hover { background: color-mix(in srgb, var(--primary-soft) 55%, var(--panel)); }
.lead-name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.lead-fav { color: var(--heat-warm); flex-shrink: 0; }
.lead-cat { color: var(--muted); font-size: 0.82rem; display: block; margin-top: 1px; }
.lead-city { white-space: nowrap; }
.lead-city small { display: block; color: var(--muted); }
.lead-phone { font-family: var(--font-mono); font-size: 0.84rem; white-space: nowrap; }
.presence-flags { display: flex; flex-wrap: wrap; gap: 4px; max-width: 190px; }
.pf { font-size: 0.74rem; font-weight: 600; border-radius: 6px; padding: 2px 7px; white-space: nowrap; }
.pf.warn { background: color-mix(in srgb, var(--heat-hot) 9%, var(--panel)); color: var(--heat-hot-on-panel); }
.pf.ok { background: color-mix(in srgb, var(--ok) 9%, var(--panel)); color: var(--ok); }
.pf.info { background: var(--panel-2); color: var(--muted); }

.score-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-weight: 600; font-size: 0.82rem;
  border-radius: 999px; padding: 3px 11px;
  border: 1px solid;
  white-space: nowrap;
}
.score-pill.alta { color: var(--heat-hot-on-panel); border-color: color-mix(in srgb, var(--heat-hot) 45%, var(--border)); background: color-mix(in srgb, var(--heat-hot) 7%, var(--panel)); }
.score-pill.media { color: var(--heat-warm-on-panel); border-color: color-mix(in srgb, var(--heat-warm) 55%, var(--border)); background: color-mix(in srgb, var(--heat-warm) 10%, var(--panel)); }
.score-pill.baixa { color: var(--heat-cold-on-panel); border-color: color-mix(in srgb, var(--heat-cold) 40%, var(--border)); background: color-mix(in srgb, var(--heat-cold) 7%, var(--panel)); }

.stage-select {
  font: inherit; font-size: 0.84rem; font-weight: 600;
  padding: 5px 8px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  cursor: pointer;
}
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; background: transparent; color: var(--muted);
  cursor: pointer;
}
.icon-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { background: var(--panel-2); color: var(--text); border-color: var(--border); }
.icon-btn.wa:hover { color: #0e7a4f; }
.icon-btn.on { color: var(--heat-warm-on-panel); }
.leads-empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.leads-empty a { font-weight: 700; }
.leads-pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 13px; font-size: 0.88rem; color: var(--muted); }

/* =================================================================== KANBAN */
.kanban {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(258px, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 10px;
  align-items: start;
}
.kb-col { background: color-mix(in srgb, var(--panel) 55%, var(--bg)); border: 1px solid var(--border); border-radius: var(--radius); min-height: 300px; display: flex; flex-direction: column; }
.kb-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.kb-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--kb, var(--muted)); }
.kb-title { font-weight: 700; font-size: 0.84rem; letter-spacing: 0.07em; text-transform: uppercase; }
.kb-count { margin-left: auto; font-family: var(--font-mono); font-size: 0.8rem; font-weight: 600; color: var(--muted); background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 1px 9px; }
.kb-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 120px; transition: background 0.15s; }
.kb-body.dragover { background: var(--primary-soft); border-radius: 0 0 var(--radius) var(--radius); }
.kb-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 12px; box-shadow: var(--shadow);
  cursor: grab;
}
.kb-card:active { cursor: grabbing; }
.kb-card.dragging { opacity: 0.45; }
.kb-card-name { font-weight: 600; font-size: 0.92rem; }
.kb-card-sub { color: var(--muted); font-size: 0.8rem; margin-top: 1px; }
.kb-card-foot { display: flex; align-items: center; gap: 6px; margin-top: 9px; }
.kb-card-foot .icon-btn { width: 26px; height: 26px; }
.kb-card-foot .icon-btn:first-of-type { margin-left: auto; }
.kb-empty { color: var(--muted); font-size: 0.84rem; text-align: center; padding: 18px 6px; }
.kb-card-when { font-size: 0.74rem; color: var(--muted); background: var(--panel-2); border-radius: 6px; padding: 2px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Colunas editáveis: remover no cabeçalho (só quando vazia), criar na coluna
   fantasma do fim do quadro. */
.kb-remove {
  border: 0; background: none; color: var(--muted);
  font-size: 1.05rem; line-height: 1; cursor: pointer;
  padding: 2px 7px; border-radius: 6px; margin-left: 2px;
}
.kb-remove:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 9%, var(--panel)); color: var(--danger); }
.kb-remove:disabled { opacity: 0.3; cursor: default; }
.kb-col.kb-add {
  background: transparent;
  border: 1.5px dashed var(--border);
  min-height: 120px;
  padding: 10px;
  justify-content: flex-start;
}
.kb-add-btn {
  width: 100%; padding: 12px;
  border: 0; background: none; border-radius: 8px;
  color: var(--muted); font: inherit; font-weight: 600; cursor: pointer;
}
.kb-add-btn:hover { background: var(--panel-2); color: var(--primary); }
.kb-add-form { display: flex; flex-direction: column; gap: 8px; }
.kb-add-form input { padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; font: inherit; }
.kb-add-actions { display: flex; gap: 6px; }

/* ================================================================= HISTÓRICO */
.timeline { display: flex; flex-direction: column; }
.tl-row { display: flex; gap: 14px; padding: 12px 4px; border-bottom: 1px solid var(--border); }
.tl-row:last-child { border-bottom: 0; }
.tl-ico { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--panel-2); color: var(--muted); }
.tl-ico.busca { background: var(--primary-soft); color: var(--primary); }
.tl-ico.proposta { background: color-mix(in srgb, var(--heat-warm) 14%, var(--panel)); color: var(--heat-warm-on-panel); }
.tl-ico.etapa { background: color-mix(in srgb, var(--ok) 10%, var(--panel)); color: var(--ok); }
.tl-ico svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tl-body { flex: 1; min-width: 0; }
.tl-text { font-size: 0.93rem; }
.tl-when { color: var(--muted); font-size: 0.8rem; }

/* ================================================================ ASSINATURA */
.sub-usage { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; margin-bottom: 16px; }
.sub-usage-info { flex: 1; min-width: 240px; }
.sub-usage h3 { font-size: 1.05rem; }
.sub-usage .form-hint { margin-top: 2px; }
.usage-bar { flex: 2; min-width: 240px; }
.usage-bar-track { height: 10px; border-radius: 5px; background: var(--panel-2); overflow: hidden; }
.usage-bar-track i { display: block; height: 100%; background: linear-gradient(90deg, #2ea36b, var(--primary)); border-radius: 5px; }
.usage-bar-label { display: flex; justify-content: space-between; font-size: 0.82rem; color: var(--muted); margin-top: 6px; font-family: var(--font-mono); }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; align-items: stretch; }
.plan {
  background: var(--panel); border: 1.5px solid var(--border); border-radius: 16px;
  padding: 24px; display: flex; flex-direction: column; gap: 6px;
  position: relative;
}
.plan.recommended { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent), var(--shadow-lift); }
.plan-flag {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--primary); color: #fff; font-size: 0.74rem; font-weight: 700;
  padding: 3px 14px; border-radius: 999px; letter-spacing: 0.04em;
  white-space: nowrap;
}
.plan-name { font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 700; color: var(--muted); }
.plan-price { font-family: var(--font-display); font-weight: 800; font-size: 2.1rem; margin: 2px 0 4px; }
.plan-price small { font-size: 0.95rem; color: var(--muted); font-weight: 500; font-family: var(--font-ui); }
.plan ul { list-style: none; margin: 8px 0 18px; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 0.9rem; }
.plan li { padding-left: 24px; position: relative; }
.plan li::before { content: ""; position: absolute; left: 2px; top: 7px; width: 10px; height: 6px; border-left: 2px solid var(--primary); border-bottom: 2px solid var(--primary); transform: rotate(-45deg); }
.plan .btn { margin-top: auto; }
.plan-current { font-size: 0.84rem; font-weight: 700; color: var(--ok); text-align: center; padding: 9px; }
.plans-foot { text-align: center; color: var(--muted); font-size: 0.85rem; margin-top: 18px; }

/* ================================================================== CONFIG */
.config-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; align-items: start; }

/* =================================================================== AJUDA */
.help-card h3 { font-size: 1.2rem; margin-bottom: 6px; }
.help-card h4 { margin: 22px 0 6px; font-size: 1rem; }
.help-card p, .help-card li { color: var(--text); font-size: 0.95rem; }
.help-card ol, .help-card ul { margin: 8px 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.help-faq details { border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; margin-top: 8px; }
.help-faq summary { font-weight: 600; cursor: pointer; }
.help-faq p { margin-top: 8px; color: var(--muted); }

/* ==================================================================== MODAL */
/* z-index 70: acima da topbar mobile sticky (60), abaixo da gaveta (75/80). */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 70;
  background: color-mix(in srgb, var(--pine-950) 48%, transparent);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  overflow: auto;
}
.modal {
  background: var(--panel); border-radius: 16px; box-shadow: var(--shadow-lift);
  width: min(640px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 26px 28px;
  animation: ob-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes ob-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
.modal h3 { font-size: 1.3rem; margin-bottom: 4px; }
.modal .form-stack { margin-top: 16px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }
.modal-close { float: right; border: 0; background: none; font-size: 1.3rem; color: var(--muted); cursor: pointer; padding: 2px 8px; border-radius: 8px; }
.modal-close:hover { background: var(--panel-2); color: var(--text); }
.lead-detail-head { display: flex; align-items: flex-start; gap: 12px; }
.lead-detail-head .score-pill { margin-left: auto; }
.lead-detail-sub { color: var(--muted); font-size: 0.9rem; margin-top: 2px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; margin-top: 16px; }
@media (max-width: 560px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-item { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.92rem; min-width: 0; }
.detail-item b { display: block; font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.detail-item a { word-break: break-all; }
.reasons { margin: 14px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.reasons li { padding-left: 22px; position: relative; font-size: 0.9rem; }
.reasons li::before { content: ""; position: absolute; left: 3px; top: 7px; width: 8px; height: 5px; border-left: 2px solid var(--primary); border-bottom: 2px solid var(--primary); transform: rotate(-45deg); }
.detail-actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.price-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Escolher etapa sem arrastar (modal "Mover para etapa" do kanban) */
.stage-pick { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.stage-pick .btn { justify-content: flex-start; padding: 11px 16px; }
.stage-pick .btn .opt { margin-left: auto; font-size: 0.8rem; }

/* =================================================================== TOASTS */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 90; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--pine-900); color: var(--pine-ink-strong);
  border-radius: 10px; padding: 12px 18px;
  font-size: 0.92rem; font-weight: 500;
  box-shadow: var(--shadow-lift);
  animation: toast-in 0.25s cubic-bezier(0.2, 0.9, 0.3, 1);
  max-width: 380px;
}
.toast.err { background: #7f1d1d; color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ======================================================= AJUSTES GLOBO/DOCK */
/* O filtro de nicho tem a linha inteira: espremido ao lado de dois botões ele
   truncava em "Todo". Girar/Recentrar moraram para os controles do mapa. */
.globe-root .globe-actions-row select {
  width: 100%;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px;
  font: inherit; font-size: 0.88rem; background: var(--panel); color: var(--text);
}
#globe-reset svg { width: 15px; height: 15px; }
#globe-spin[aria-pressed="true"] { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); }

/* Cartão de seleção: ação principal na linha inteira, secundárias dividindo a
   linha de baixo, em vez de três pílulas empilhadas. */
.globe-root .globe-selection { padding: 14px 16px; }
.globe-root .globe-sel-title { font-size: 17px; }
.globe-root .globe-sel-actions { margin-top: 6px; }
.globe-root .globe-sel-actions .btn { flex: 1 1 calc(50% - 4px); justify-content: center; white-space: nowrap; padding: 6px 8px; font-size: 0.83rem; }
.globe-root .globe-sel-actions .btn.primary { flex-basis: 100%; padding: 8px 12px; font-size: 0.9rem; }

/* Cabeçalho da lista: o título flexiona e o "?" fica colado nele, em vez de
   cair sozinho na linha de baixo. */
.globe-root .globe-regions-head .detail-title { flex: 1 1 0; min-width: 0; }
.globe-root .globe-help-btn.sm { margin-right: 0; }

/* Os "?" do globo abrem um MODAL centralizado, não um balão ancorado que a
   coluna estreita cortava. Fundo escurece o app; ✕, Escape ou clique fora
   fecham (a lógica de abrir/fechar continua a do globe.js). */
.globe-root:has(.globe-help:not([hidden]))::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 66;
  background: color-mix(in srgb, var(--pine-950) 38%, transparent);
  backdrop-filter: blur(3px);
}
.globe-root .globe-help {
  position: fixed;
  z-index: 68;
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 48px));
  max-height: min(78vh, 640px);
  overflow: auto;
  padding: 22px 26px;
  border-radius: 16px;
  box-shadow: var(--shadow-lift);
}
.globe-root .globe-help .globe-hint { font-size: 0.94rem; line-height: 1.6; }
.globe-help-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: 0;
  background: none;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}
.globe-help-close:hover { background: var(--panel-2); color: var(--text); }
/* No dock o stage NÃO é quadrado: o aspect-ratio 1/1 do dashboard interno,
   somado a um min-height, forçava largura maior que a coluna do grid e a
   coluna lateral cobria o mapa. Aqui a coluna manda na largura e o min-height
   na altura. */
.globe-dock .globe-stage { aspect-ratio: auto; max-height: none; height: 100%; min-height: 480px; }
.globe-dock .globe-layout { grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr); align-items: stretch; }
/* A lista de lugares scrolla sozinha dentro da própria caixa (borda + cantos
   arredondados dão o "fim" visual); a coluna em volta não scrolla, então há um
   único scroll. A barra fica fina e afastada da borda. */
.globe-dock .globe-side-inner { overflow: hidden; }
.globe-root .globe-regions { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 40%, transparent) transparent; }
.globe-root .globe-regions::-webkit-scrollbar { width: 10px; }
.globe-root .globe-regions::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--muted) 35%, transparent);
  border-radius: 5px;
  border: 3px solid var(--panel);
}
.globe-root .globe-regions::-webkit-scrollbar-track { background: transparent; }
/* Título e resumo da cobertura em linhas próprias: lado a lado eles brigavam
   pela largura estreita da coluna e quebravam feio. */
.globe-root .globe-regions-head { display: flex; flex-wrap: wrap; align-items: center; row-gap: 2px; }
.globe-summary { flex-basis: 100%; order: 10; margin-left: 0; font-size: 0.78rem; color: var(--muted); }

/* ================================================================== MOBILE
   O shell troca de natureza em telas estreitas: o sidebar vira gaveta, uma
   topbar navy com hambúrguer assume a navegação, e a Nova Busca empilha
   globo → lista de cobertura → formulário. */
@media (max-width: 860px) {
  .app { display: block; }
  body { overflow-x: clip; }
  /* Só no mobile: a gaveta aberta trava o scroll do fundo; se a janela alargar
     com ela aberta, o desktop não fica preso. */
  body.no-scroll { overflow: hidden; }

  /* -- topbar mobile ------------------------------------------------------ */
  .mobile-topbar {
    display: flex; align-items: center; gap: 10px;
    position: sticky; top: 0; z-index: 60;
    background: linear-gradient(175deg, var(--pine-900), var(--pine-950));
    padding: 8px 12px;
    padding-top: calc(8px + env(safe-area-inset-top));
    border-bottom: 1px solid var(--pine-line);
  }
  .mobile-topbar .brand-mark { width: 24px; height: 24px; }
  .mobile-topbar .brand-name { color: var(--pine-ink-strong); font-size: 1rem; }
  .mobile-topbar .quota-chip {
    margin-left: auto;
    background: var(--pine-800); border-color: var(--pine-line);
    color: var(--pine-ink); box-shadow: none;
    font-size: 0.8rem; padding: 5px 12px 5px 7px;
  }
  .mobile-topbar .quota-chip b { color: var(--pine-ink-strong); }
  .mobile-topbar .quota-ring {
    background: conic-gradient(var(--primary-bright) calc(var(--used, 0) * 1%), var(--pine-950) 0);
    border-color: var(--pine-line);
    width: 18px; height: 18px;
  }

  /* -- sidebar como gaveta ------------------------------------------------ */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: min(300px, 85vw);
    height: 100vh;
    height: 100dvh;
    z-index: 80;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    overflow-y: auto;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }
  .app.nav-open .sidebar { transform: translateX(0); box-shadow: 12px 0 48px rgba(8, 18, 38, 0.45); }
  .nav a { padding: 12px; } /* alvo de toque confortável */
  .nav-backdrop {
    display: block;
    position: fixed; inset: 0; z-index: 75;
    background: color-mix(in srgb, var(--pine-950) 45%, transparent);
    backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .app.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }

  /* -- cabeçalho da página ------------------------------------------------ */
  .topbar { padding: 16px 16px 0; flex-wrap: wrap; gap: 10px; }
  .topbar-title h1 { font-size: 1.35rem; }
  .topbar .quota-chip { display: none; } /* a cota mora na topbar mobile */
  .content { padding: 14px 16px 36px; }

  /* -- nova busca: globo em cima, lista abaixo, formulário abaixo --------- */
  .busca-layout { gap: 12px; }
  .globe-dock { min-height: 0; }
  .globe-dock .globe-layout { grid-template-columns: 1fr; min-height: 0; gap: 12px; }
  .globe-dock .globe-stage {
    height: auto;
    aspect-ratio: 1 / 1;
    min-height: 280px;
    max-height: 64vh;
  }
  .globe-root .globe-help { max-height: min(84dvh, 640px); }
  .globe-row { padding: 12px 14px; }
  .globe-controls button { width: 34px; height: 34px; }

  /* -- alvos de toque e zoom do iOS --------------------------------------- */
  .icon-btn { width: 38px; height: 38px; }
  /* 16px é o mínimo que impede o Safari iOS de dar zoom ao focar um campo */
  label input, label select, label textarea,
  .leads-toolbar input[type="search"], .leads-toolbar select,
  .stage-select, #globe-search, .globe-root .globe-actions-row select { font-size: 16px; }
}

/* Meus leads: a tabela vira uma lista de cards; pipeline ganha snap. */
@media (max-width: 700px) {
  .leads-toolbar { padding: 12px 14px 10px; }
  .leads-toolbar input[type="search"] { flex-basis: 100%; }
  .leads-toolbar select { flex: 1 1 40%; max-width: none; min-width: 0; }
  .leads-toolbar-right { margin-left: 0; flex-basis: 100%; }
  .leads-toolbar-right .btn { flex: 1; }
  .leads-quickfilters { flex-wrap: nowrap; overflow-x: auto; padding: 0 14px 12px; scrollbar-width: none; }
  .leads-quickfilters::-webkit-scrollbar { display: none; }
  .chip-filter { flex-shrink: 0; }

  .leads-table thead { display: none; }
  .leads-table, .leads-table tbody { display: block; }
  .leads-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 12px;
    padding: 14px;
    border-bottom: 1px solid var(--border);
  }
  .leads-table td { display: block; padding: 0; border: 0; }
  .leads-table td:nth-child(2) { color: var(--muted); font-size: 0.85rem; white-space: normal; }
  .lead-city small { display: inline; margin-left: 5px; }
  .lead-city small:not(:empty)::before { content: "· "; }
  .leads-table td:nth-child(3) { margin-top: 2px; }
  .leads-table td:nth-child(4) { grid-column: 1 / -1; margin-top: 8px; }
  .presence-flags { max-width: none; }
  .leads-table td:nth-child(5) { grid-column: 1 / -1; margin-top: 10px; }
  .stage-select { width: 100%; padding: 10px 12px; }
  .leads-table td:nth-child(6) { grid-column: 2; grid-row: 1 / span 3; align-self: start; }
  .row-actions { gap: 6px; }

  .kanban {
    grid-auto-columns: min(82vw, 320px);
    scroll-snap-type: x proximity;
    scroll-padding-left: 16px;
    margin: 0 -16px;
    padding: 0 16px 12px;
  }
  .kb-col { scroll-snap-align: start; }
  .kb-card-foot .icon-btn { width: 34px; height: 34px; }
}

/* Telefones: modal vira bottom sheet, toasts ocupam a largura, tudo respira. */
@media (max-width: 560px) {
  .card { padding: 16px 14px; }
  .busca-map { padding: 10px; }

  .tiles { gap: 10px; }
  .tile { padding: 13px 14px; min-height: 88px; }
  .tile-value { font-size: 1.65rem; }
  .funil-row { grid-template-columns: 96px 1fr 40px; gap: 8px; }
  .funil-label { font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal {
    width: 100%;
    max-height: calc(100dvh - 32px);
    border-radius: 20px 20px 0 0;
    padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
    animation: sheet-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
  }
  .modal-actions { flex-wrap: wrap; }
  .detail-actions .btn, .modal-actions .btn { flex: 1 1 calc(50% - 5px); }

  .toasts {
    left: 16px; right: 16px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    align-items: stretch;
  }
  .toast { max-width: none; text-align: center; }
}
@keyframes sheet-in { from { opacity: 0.5; transform: translateY(48px); } }

/* =============================== Propostas =============================== */

.props-card { padding: 0; overflow: hidden; }
.props-toolbar { display: flex; gap: 10px; padding: 14px 16px; align-items: center; border-bottom: 1px solid var(--border); }
.props-toolbar select { padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px; font: inherit; background: var(--panel); }
.props-toolbar-right { margin-left: auto; }

.props-list { display: flex; flex-direction: column; }
.prop-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  cursor: pointer;
}
.prop-row:last-child { border-bottom: 0; }
.prop-row:hover, .prop-row:focus-visible { background: var(--panel-2); outline: none; }
.prop-row-ico {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary-strong);
}
.prop-row-ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.prop-row-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.prop-row-title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prop-row-sub { color: var(--muted); font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prop-row .row-actions { flex: 0 0 auto; }

.prop-chip {
  flex: 0 0 auto; font-size: 0.74rem; font-weight: 700;
  border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}
.prop-chip.st-gerando { background: var(--primary-soft); color: var(--primary-strong); }
.prop-chip.st-rascunho { background: color-mix(in srgb, var(--muted) 12%, var(--panel)); color: var(--muted); }
.prop-chip.st-enviada { background: color-mix(in srgb, var(--primary) 12%, var(--panel)); color: var(--primary-strong); }
.prop-chip.st-aceita { background: color-mix(in srgb, var(--ok) 12%, var(--panel)); color: var(--ok); }
.prop-chip.st-recusada { background: color-mix(in srgb, var(--heat-warm) 16%, var(--panel)); color: var(--heat-warm-on-panel); }
.prop-chip.st-falhou { background: color-mix(in srgb, var(--danger) 10%, var(--panel)); color: var(--danger); }

.props-empty { padding: 44px 20px; text-align: center; color: var(--muted); }

/* Editor */
.prop-editor { display: flex; flex-direction: column; gap: 12px; }
.prop-editor-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.prop-editor-top input#prop-title {
  flex: 1 1 240px; min-width: 0;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px;
  font: 650 1.02rem var(--font-ui); color: var(--text); background: var(--panel);
}
.prop-editor-top select { padding: 9px 10px; border: 1px solid var(--border); border-radius: 9px; font: inherit; background: var(--panel); }

.prop-meta { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 0.86rem; }
.prop-meta:empty { display: none; }
.prop-lead-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 10px; font-weight: 600; color: var(--text); font-size: 0.8rem;
}
.prop-lead-chip svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.prop-meta-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.prop-wa { color: #0e7a4f; border-color: color-mix(in srgb, #0e7a4f 35%, var(--border)); }

.prop-toolbar {
  display: flex; gap: 4px; align-items: center; flex-wrap: wrap;
  padding: 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2);
}
.prop-toolbar button {
  border: 0; background: transparent; border-radius: 7px;
  padding: 6px 10px; font: 600 0.85rem var(--font-ui); color: var(--text); cursor: pointer;
}
.prop-toolbar button:hover { background: var(--panel); box-shadow: var(--shadow); }
.prop-tb-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }

.prop-content {
  min-height: 380px; padding: 22px clamp(18px, 4vw, 40px);
  border: 1px solid var(--border); border-radius: 12px; background: var(--panel);
  line-height: 1.65; outline: none;
}
.prop-content:focus-visible { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.prop-content h1, .prop-content h2 { font-family: var(--font-display); margin: 20px 0 8px; }
.prop-content h2 { font-size: 1.25rem; }
.prop-content h3 { font-size: 1.02rem; margin: 16px 0 6px; }
.prop-content p { margin: 8px 0; }
.prop-content ul, .prop-content ol { padding-left: 22px; margin: 8px 0; }
.prop-content blockquote {
  margin: 12px 0; padding: 8px 16px; border-left: 3px solid var(--primary);
  background: var(--primary-soft); border-radius: 0 8px 8px 0;
}
.prop-content table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 0.92rem; }
.prop-content th, .prop-content td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; }
.prop-content th { background: var(--panel-2); }
.prop-content img { max-width: 100%; height: auto; border-radius: 8px; }
.prop-content hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }

.prop-generating {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  padding: 18px; border: 1px dashed var(--border); border-radius: 12px;
  background: var(--panel-2); color: var(--muted);
}
.prop-generating.err {
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
  background: color-mix(in srgb, var(--danger) 5%, var(--panel));
  color: var(--text);
}

/* Modal: nova proposta */
.prop-new-tabs { display: flex; gap: 6px; margin: 14px 0 4px; }
.prop-new-tab {
  flex: 1; border: 1px solid var(--border); background: var(--panel);
  border-radius: 9px; padding: 8px 10px; font: 600 0.86rem var(--font-ui);
  color: var(--muted); cursor: pointer;
}
.prop-new-tab[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-strong); }
.prop-new-pane { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.prop-new-pane .form-hint { margin: 0; }
.prop-new-pane label { width: 100%; }

@media (max-width: 560px) {
  /* Linha 1: voltar à esquerda, status + salvar colados à direita; o título
     ganha a linha inteira logo abaixo. */
  .prop-editor-top { gap: 8px; }
  .prop-editor-top input#prop-title { flex-basis: 100%; order: 3; }
  .prop-editor-top #prop-status { margin-left: auto; }
  /* O bloco do link (status de visualização + ações) vira um painel agrupado
     em vez de texto e botões soltos no meio da página. */
  .prop-meta {
    gap: 8px 10px; padding: 10px 12px;
    border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2);
  }
  .prop-meta-actions {
    margin-left: 0; width: 100%;
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  }
  .prop-meta-actions .prop-wa { grid-column: 1 / -1; }
  .prop-row-sub { white-space: normal; }
  .prop-new-tabs { flex-direction: column; }
}

/* ---------------------------------------------------------------------------
   Propostas: editor por template (prévia editável) e seletor de templates
--------------------------------------------------------------------------- */

.prop-design-bar {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2);
}
.prop-tpl-name { font-weight: 650; }
.prop-font-pick { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--muted); }
.prop-font-pick select { padding: 7px 8px; border: 1px solid var(--border); border-radius: 8px; font: inherit; font-size: 0.85rem; background: var(--panel); max-width: 150px; }
.prop-accents { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.accent-sw { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--panel); background: var(--sw); cursor: pointer; box-shadow: 0 0 0 1px var(--border); padding: 0; }
.accent-sw:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 50%, var(--border)); }
.accent-sw.active { box-shadow: 0 0 0 2px var(--primary); }
.accent-sw.auto { background: linear-gradient(135deg, var(--sw) 55%, var(--panel) 55%); }
.prop-accents input[type="color"] { width: 26px; height: 26px; padding: 1px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); cursor: pointer; }
.prop-design-right { margin-left: auto; display: flex; gap: 8px; }
.prop-frame-wrap { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #eff1ed; }
#prop-frame { width: 100%; height: min(76vh, 900px); border: 0; display: block; background: transparent; transition: opacity 0.18s ease; }
/* Meio-fade durante o re-render de template: sem flash branco na troca. */
#prop-frame.swapping { opacity: 0.4; }
.prop-toolbar.tpl-mode [data-block] { display: none; }

.tpl-fams { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.tpl-fam { border: 1px solid var(--border); background: var(--panel); border-radius: 999px; padding: 6px 13px; cursor: pointer; font-family: inherit; font-size: 0.82rem; font-weight: 600; color: var(--text); }
.tpl-fam.active { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 14px; max-height: min(64vh, 680px); overflow: auto; padding: 4px; }
.tpl-card { border: 1px solid var(--border); border-radius: 12px; background: var(--panel); cursor: pointer; overflow: hidden; transition: border-color 0.12s ease, box-shadow 0.12s ease; }
.tpl-card:hover, .tpl-card:focus-visible { border-color: var(--primary); box-shadow: var(--shadow-lift); outline: none; }
.tpl-card.active { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 35%, transparent); }
.tpl-thumb { position: relative; height: 238px; overflow: hidden; background: #eff1ed; pointer-events: none; }
.tpl-thumb iframe { width: 900px; height: 1200px; border: 0; transform: scale(0.246); transform-origin: 0 0; }
.tpl-card-name { padding: 8px 10px 2px; font-weight: 650; font-size: 0.86rem; }
.tpl-card-sub { padding: 0 10px 10px; color: var(--muted); font-size: 0.74rem; }

@media (max-width: 700px) {
  /* A barra de design deixa de quebrar linha a esmo e vira uma grade:
     template na largura toda, fontes lado a lado, cores e exportação abaixo. */
  .prop-design-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; }
  #prop-tpl-btn { grid-column: 1 / -1; padding: 9px 12px; font-size: 0.9rem; }
  .prop-font-pick { flex-direction: column; align-items: stretch; gap: 4px; }
  .prop-font-pick select { max-width: none; width: 100%; }
  .prop-accents { grid-column: 1 / -1; }
  .prop-design-right { grid-column: 1 / -1; margin-left: 0; width: 100%; }
  .prop-design-right .btn { flex: 1; }
  #prop-frame { height: 70vh; }

  /* Toolbar de formatação em linha única com scroll horizontal, no lugar de
     duas linhas quebradas. */
  .prop-toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .prop-toolbar::-webkit-scrollbar { display: none; }
  .prop-toolbar button { flex: 0 0 auto; padding: 8px 12px; }
  .prop-tb-sep { flex: 0 0 auto; }
}

/* ---------------------------------------------------------------------------
   Wizard de nova proposta: conteúdo → loading → template → cor → fontes
--------------------------------------------------------------------------- */

/* O modal do wizard anima a mudança de largura entre os passos (conteúdo ↔ design). */
.modal.wiz-modal { transition: width 0.3s cubic-bezier(0.2, 0.9, 0.3, 1); }
.modal.modal-wide { width: min(880px, 96vw); }

.wiz-pane { animation: wiz-fade 0.24s ease; }
@keyframes wiz-fade { from { opacity: 0; transform: translateY(6px); } }

.wiz-steps { display: flex; gap: 6px; flex-wrap: wrap; margin: 2px 0 14px; }
.wiz-step {
  font-family: inherit; font-size: 0.78rem; font-weight: 600; color: var(--muted);
  padding: 5px 12px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.wiz-step:hover:not(:disabled):not(.active) { border-color: var(--primary); color: var(--primary); }
.wiz-step:disabled { cursor: default; opacity: 0.6; }
.wiz-step.active { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.wiz-step.done { color: var(--primary); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); background: var(--primary-soft); }

.wiz-loading { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 64px 16px 58px; text-align: center; }
.wiz-loading-orb {
  width: 68px; height: 68px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary-soft);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--primary-soft) 45%, transparent);
  margin-bottom: 10px;
}
.wiz-loading .spinner { width: 30px; height: 30px; border-width: 3px; color: var(--primary); }
.wiz-loading-msg { font-weight: 650; font-size: 1.05rem; }
.wiz-loading-msg.swap { animation: wiz-fade 0.35s ease; }
.wiz-loading .form-hint { margin: 0; }

.wiz-side { display: flex; gap: 7px; flex-wrap: wrap; justify-content: center; align-items: center; min-height: 36px; margin-bottom: 10px; }
.wiz-side > * { animation: wiz-fade 0.2s ease both; }
.wiz-side-label { color: var(--muted); font-size: 0.82rem; font-weight: 600; }

/* Filtro de famílias: seletor central só com as palavras, sem borda nem
   trilho. A ativa fica no meio, as vizinhas aparecem pelas pontas com fade,
   e o padding de 50% deixa qualquer palavra (até a primeira) centralizar. */
.wiz-side .tpl-fam-scroll {
  width: min(100%, 330px); overflow-x: auto; scrollbar-width: none; padding: 2px 0;
  mask-image: linear-gradient(to right, transparent, #000 56px, #000 calc(100% - 56px), transparent);
}
.wiz-side .tpl-fam-scroll::-webkit-scrollbar { display: none; }
.wiz-side .tpl-fam-track { display: flex; align-items: center; gap: 8px; width: max-content; padding: 0 50%; }
.wiz-side .tpl-fam {
  border: 0; background: none;
  padding: 6px 8px; font-size: 0.84rem; white-space: nowrap; color: var(--muted);
  transition: color 0.15s ease;
}
.wiz-side .tpl-fam:hover:not(.active) { color: var(--text); }
.wiz-side .tpl-fam.active { color: var(--primary); font-weight: 700; }

/* Setas flutuam sobre a prévia: a prévia ganha toda a largura, inclusive no mobile. */
.wiz-stage { position: relative; }
.wiz-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 90%, transparent);
  backdrop-filter: blur(6px);
  color: var(--text); font-size: 22px; line-height: 1; cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.wiz-arrow[hidden] { display: none; }
.wiz-arrow:hover { border-color: var(--primary); color: var(--primary); box-shadow: var(--shadow-lift); transform: translateY(-50%) scale(1.06); }
.wiz-arrow:active { transform: translateY(-50%) scale(0.96); }
#wiz-prev { left: 8px; }
#wiz-next { right: 8px; }

/* A escala (--wiz-scale) vem do JS a partir da largura real: a página de 900px
   sempre cabe inteira, sem corte lateral em tela estreita. */
.wiz-frame-wrap {
  position: relative;
  width: 100%; max-width: 560px; height: min(56vh, 620px);
  margin: 0 auto;
  overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain;
  border: 1px solid var(--border); border-radius: 12px; background: #eff1ed;
  --wiz-scale: 0.6222;
}
.wiz-frame-wrap::before {
  content: ''; position: absolute; top: 110px; left: 50%; margin-left: -14px;
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}
.wiz-frame-clip {
  position: relative; z-index: 1;
  width: calc(900px * var(--wiz-scale)); height: calc(2300px * var(--wiz-scale));
  overflow: hidden; pointer-events: none;
}
/* Dois iframes empilhados: o novo carrega atrás e entra em crossfade, sem tela branca. */
.wiz-frame {
  position: absolute; top: 0; left: 0;
  width: 900px; height: 2300px; border: 0;
  transform: scale(var(--wiz-scale)); transform-origin: 0 0;
  opacity: 0; transition: opacity 0.25s ease;
}
.wiz-frame.is-front { opacity: 1; }
.wiz-caption { text-align: center; color: var(--muted); font-size: 0.86rem; margin-top: 10px; }
.wiz-caption b { color: var(--text); }
.wiz-caption-sub { display: block; font-size: 0.76rem; margin-top: 2px; }
.wiz-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; }
.wiz-actions #wiz-back[hidden] { display: none; }
.wiz-actions #wiz-go { margin-left: auto; min-width: 150px; }

@media (max-width: 720px) {
  .wiz-arrow { width: 36px; height: 36px; font-size: 19px; }
  .wiz-frame-wrap { height: 52vh; }
}
@media (max-width: 560px) {
  .modal.modal-wide { width: 100%; }
  .wiz-actions .btn { flex: 1; }
  .wiz-side .prop-font-pick { width: 100%; justify-content: space-between; }
  .wiz-side .prop-font-pick select { flex: 1; max-width: none; }
}
