/* ============================================================================
   maxxBI · Estilos
   ============================================================================ */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --teal:    #22B8A8;
  --indigo:  #3949CC;
  --purple:  #7B3FE4;
  --magenta: #D63A9E;
  --grad: linear-gradient(135deg, #22B8A8 0%, #3949CC 35%, #7B3FE4 65%, #D63A9E 100%);

  --bg: #F7F6FB;
  --bg-alt: #FFFFFF;
  --ink: #1A1430;
  --ink-soft: #5B5470;
  --ink-mute: #9590A8;
  --line: #E8E5F0;
  --line-soft: #F0EDF6;
  --green: #0E9F6E;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.mono { font-family: 'JetBrains Mono', monospace; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--purple); }

/* ====== TOPNAV ====== */
.topnav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 32px; background: var(--bg-alt);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 100;
}
.topnav-left  { display: flex; align-items: center; gap: 40px; }
.topnav-right { display: flex; align-items: center; gap: 14px; }
.logo { display: flex; align-items: center; }
.tabs { display: flex; gap: 4px; }
.tab {
  padding: 10px 16px; color: var(--ink-soft);
  font-size: 14px; font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  display: flex; align-items: baseline; gap: 8px;
  transition: all 0.15s;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); font-weight: 600; border-bottom-color: var(--purple); }
.tab-num { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--ink-mute); }
.tab.active .tab-num { color: var(--purple); }

.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--grad);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
}

/* ====== BOTÕES ====== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: 10px; border: none;
  font-size: 14px; font-weight: 600; transition: all 0.2s;
}
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-primary { background: var(--grad); color: #fff;
  box-shadow: 0 6px 14px -6px rgba(123,63,228,0.55); }
.btn-primary:hover { transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--bg); color: var(--ink); }
.btn-full { width: 100%; }

/* ====== CARDS / LAYOUT ====== */
.page { padding: 36px 32px; }
.card {
  background: var(--bg-alt); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 1px 2px rgba(26,20,48,0.04);
}
.section-head { margin-bottom: 28px; }
.section-head .kicker {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--purple); letter-spacing: 0.2em; font-weight: 500;
}
.section-head h1 {
  font-size: 42px; margin: 6px 0 0; font-weight: 700;
  letter-spacing: -0.025em; line-height: 1.1;
}
.section-head h1 em {
  font-style: italic; font-weight: 600;
  background: var(--grad);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.section-head p { color: var(--ink-soft); max-width: 640px; margin-top: 8px; }

/* ====== TABELA ====== */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; padding: 14px 24px;
  font-size: 10px; color: var(--ink-mute); letter-spacing: 0.15em;
  font-family: 'JetBrains Mono', monospace; font-weight: 500;
  border-bottom: 1px solid var(--line); background: #fff;
}
.table td {
  padding: 14px 24px; font-size: 14px;
  border-bottom: 1px solid var(--line-soft);
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg); }
.badge {
  display: inline-block; padding: 4px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.05em;
}
.badge-meta   { background: rgba(214,58,158,0.12); color: var(--magenta); }
.badge-google { background: rgba(57,73,204,0.12);  color: var(--indigo); }
.status-on    { color: var(--green); font-weight: 600; font-size: 11px; letter-spacing: 0.1em; }
.status-off   { color: var(--ink-mute); font-weight: 600; font-size: 11px; letter-spacing: 0.1em; }

/* ====== KPIs ====== */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi { padding: 24px; position: relative; overflow: hidden; }
.kpi .blob {
  position: absolute; top: -30px; right: -30px;
  width: 100px; height: 100px; border-radius: 50%; opacity: 0.08;
}
.kpi .label {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  color: var(--ink-mute); letter-spacing: 0.18em;
}
.kpi .value {
  font-size: 32px; margin: 6px 0 8px; font-weight: 700; letter-spacing: -0.025em;
}
.kpi .delta { font-size: 12px; font-weight: 600; font-family: 'JetBrains Mono', monospace; }
.delta-up   { color: var(--green); }
.delta-down { color: var(--magenta); }

/* ====== FORM ====== */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; font-size: 11px; color: var(--ink-soft);
  letter-spacing: 0.1em; font-family: 'JetBrains Mono', monospace; margin-bottom: 6px;
}
.input {
  width: 100%; padding: 13px 15px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); font-size: 15px; font-family: inherit;
  outline: none; transition: all 0.2s;
}
.input:focus { border-color: var(--purple); background: #fff;
  box-shadow: 0 0 0 3px rgba(123,63,228,0.1); }

/* ====== LOGIN ====== */
.login-wrap { display: flex; min-height: 100vh; }
.login-brand {
  flex: 1.2; padding: 48px 60px;
  display: flex; flex-direction: column; justify-content: space-between;
  background: var(--grad); color: #fff;
  position: relative; overflow: hidden;
}
.login-brand .blob1, .login-brand .blob2 {
  position: absolute; border-radius: 50%; filter: blur(70px); z-index: 0;
}
.login-brand .blob1 { width: 500px; height: 500px; background: rgba(255,255,255,0.1);
  top: -200px; right: -200px; animation: float 12s ease-in-out infinite; }
.login-brand .blob2 { width: 400px; height: 400px; background: rgba(34,184,168,0.4);
  bottom: -150px; left: -100px; animation: float 14s ease-in-out infinite reverse; }
.login-brand > * { position: relative; z-index: 1; }
.login-headline { font-size: 56px; line-height: 1.05; font-weight: 700; letter-spacing: -0.02em; }
.login-headline em { font-style: italic; font-weight: 400; }
.login-tagline { max-width: 460px; margin-top: 20px; line-height: 1.6; font-size: 16px; opacity: 0.92; }
.login-stats { display: flex; gap: 32px; font-size: 13px; opacity: 0.85; }
.login-stats strong { font-size: 22px; font-weight: 600; font-family: 'JetBrains Mono', monospace; display: block; }

.login-form {
  flex: 1; padding: 64px 70px;
  display: flex; align-items: center; background: var(--bg-alt);
}
.login-form .inner { width: 100%; max-width: 380px; }
.login-form h2 { font-size: 36px; margin: 8px 0 8px; font-weight: 700; letter-spacing: -0.02em; }
.login-form .sub { color: var(--ink-soft); margin-bottom: 32px; }
.login-error {
  background: rgba(214,58,158,0.08); border: 1px solid rgba(214,58,158,0.25);
  color: var(--magenta); padding: 10px 14px; border-radius: 8px;
  margin-bottom: 18px; font-size: 13px; font-weight: 500;
}
.login-hint { margin-top: 22px; font-size: 12px; color: var(--ink-mute); line-height: 1.6; }
.login-hint code { background: var(--bg); padding: 2px 6px; border-radius: 4px;
  font-family: 'JetBrains Mono', monospace; font-size: 11px; }

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-20px) rotate(8deg); }
}

/* ====== MAPA ====== */
.mapa-grid { display: grid; grid-template-columns: 1fr 400px; gap: 22px; }
#map { width: 100%; height: 560px; border-radius: 14px; }
.layer-switch {
  position: absolute; top: 16px; right: 16px; z-index: 500;
  background: #fff; padding: 4px; border-radius: 10px; border: 1px solid var(--line);
  display: flex; gap: 2px;
}
.layer-switch button {
  background: transparent; border: none; padding: 8px 14px;
  font-size: 12px; font-weight: 500; color: var(--ink-soft); border-radius: 7px;
}
.layer-switch button.on { color: #fff; }
.layer-switch button.on.renda     { background: var(--purple); }
.layer-switch button.on.populacao { background: var(--teal); }
.layer-switch button.on.clientes  { background: var(--magenta); }

.bairro-panel { padding: 24px; }
.bairro-panel h3 { font-size: 26px; margin: 6px 0 22px; font-weight: 700; letter-spacing: -0.02em; }
.source-badge { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.source-badge .dot { width: 6px; height: 6px; border-radius: 50%; animation: pulse 2s ease-in-out infinite; }
.source-badge .lbl { font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: 0.2em; font-weight: 600; }
.source-ibge .dot, .source-ibge .lbl { background: var(--teal); }
.source-ibge .lbl { background: none; color: var(--teal); }
.source-pg .dot, .source-pg .lbl { background: var(--purple); }
.source-pg .lbl { background: none; color: var(--purple); }
@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 22px; }
.stat-label { font-size: 11px; color: var(--ink-mute); margin-bottom: 2px; }
.stat-value { font-size: 19px; font-weight: 600; letter-spacing: -0.02em; }
.query-box {
  margin-top: 18px; padding: 14px; background: var(--bg);
  border-radius: 10px; border: 1px solid var(--line);
}
.query-box pre {
  margin: 6px 0 0; font-size: 11.5px; color: var(--ink-soft);
  font-family: 'JetBrains Mono', monospace; white-space: pre-wrap; line-height: 1.55;
}
.query-box .kicker {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  color: var(--purple); letter-spacing: 0.2em; font-weight: 600;
}

/* ====== INTEGRAÇÕES ====== */
.integ-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 28px; }
.integ-card { padding: 24px; position: relative; overflow: hidden; }
.integ-card .strip { position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--line); }
.integ-card.on .strip.meta   { background: var(--magenta); }
.integ-card.on .strip.google { background: var(--indigo); }
.integ-brand { display: flex; justify-content: space-between; align-items: flex-start; }
.integ-name  { font-size: 21px; font-weight: 700; letter-spacing: -0.01em; }
.integ-name.meta   { color: var(--magenta); }
.integ-name.google { color: var(--indigo); }
.integ-sub   { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.integ-pill {
  padding: 5px 12px; border-radius: 99px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink-mute);
}
.integ-pill.on { background: rgba(14,159,110,0.1); border-color: var(--green); color: var(--green); }
.integ-body { margin: 24px 0; min-height: 76px; }
.integ-body .kicker { font-family: 'JetBrains Mono', monospace; font-size: 11px;
  color: var(--ink-mute); letter-spacing: 0.1em; }
.integ-body .conta { font-size: 16px; font-weight: 600; margin: 4px 0 12px; }
.integ-body .sinc { font-size: 12px; color: var(--ink-soft); }
.integ-body .sinc strong { font-weight: 600; }
.integ-body.meta .sinc strong   { color: var(--magenta); }
.integ-body.google .sinc strong { color: var(--indigo); }
.integ-actions { display: flex; gap: 8px; }
.btn-meta   { background: var(--magenta); color: #fff; }
.btn-google { background: var(--indigo); color: #fff; }

.campaigns-head {
  padding: 18px 24px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; background: var(--bg);
  border-radius: 16px 16px 0 0;
}

/* ====== BI ====== */
.bi-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-bottom: 22px; }
.chart-card { padding: 26px; margin-bottom: 22px; }
.chart-card .header {
  display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 18px;
}
.chart-card .kicker {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  color: var(--purple); letter-spacing: 0.18em; font-weight: 600;
}
.chart-card h3 { font-size: 21px; margin: 4px 0 0; font-weight: 700; letter-spacing: -0.015em; }
.legend { display: flex; gap: 18px; font-size: 12px; color: var(--ink-soft); }
.legend span.swatch { display: inline-block; width: 12px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }

.funil-row { margin-bottom: 12px; }
.funil-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.funil-bar  { height: 10px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.funil-fill { height: 100%; border-radius: 5px; transition: width 0.6s ease; }

/* ====== RESPONSIVO ====== */
@media (max-width: 1000px) {
  .login-wrap { flex-direction: column; }
  .login-brand, .login-form { padding: 36px; }
  .login-headline { font-size: 40px; }
  .mapa-grid, .integ-grid, .bi-grid-2 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .tabs .tab { padding: 8px 10px; font-size: 13px; }
  .topnav { padding: 12px 16px; }
  .page { padding: 24px 16px; }
}
