:root{
  --bg: #fbf9f6;
  --surface: #ffffff;
  --ink: #201a16;
  --ink-dim: #6b5f56;
  --ink-faint: #9c9089;
  --border: #ece5dc;
  --border-strong: #ddd3c6;
  --coral: #ff5a2e;
  --coral-dark: #d6431d;
  --coral-tint: #fff0ea;
  --gold: #cf8b12;
  --gold-tint: #fbf1de;
  --green: #1c8a4b;
  --green-tint: #e8f6ec;
  --red: #d1293f;
  --red-tint: #fbe7e9;
  --navy: #1c3a52;
  --navy-tint: #e8eef3;
  --sidebar-w: 232px;
  --sidebar-w-collapsed: 72px;
  --mono: ui-monospace, "SFMono-Regular", "Consolas", "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}
*{box-sizing:border-box; margin:0; padding:0;}
html,body{ background:var(--bg); color:var(--ink); font-family:var(--sans); font-size:13px; -webkit-font-smoothing:antialiased; }
img{max-width:100%;}
a{color:inherit; text-decoration:none;}

.shell{ display:flex; min-height:100vh; }

/* ---------- SIDEBAR ---------- */
.sidebar{
  width:var(--sidebar-w); flex-shrink:0; background:var(--ink); color:#fff;
  display:flex; flex-direction:column; border-right:3px solid var(--coral);
  transition:width .22s ease; overflow:hidden; position:sticky; top:0; height:100vh;
}
.shell.collapsed .sidebar{ width:var(--sidebar-w-collapsed); }

.sidebar-top{ display:flex; align-items:center; justify-content:space-between; padding:18px 16px; gap:10px; }
.brand{ display:flex; align-items:center; gap:10px; min-width:0; }
.brand-mark{ width:32px; height:32px; border-radius:8px; background:var(--coral); flex-shrink:0; display:flex; align-items:center; justify-content:center; font-weight:800; font-size:15px; color:#fff; }
img.brand-mark{ background:none; border-radius:0; object-fit:contain; }
.brand-name{ font-weight:800; font-size:16px; letter-spacing:0.2px; white-space:nowrap; }
.shell.collapsed .brand-name{ display:none; }

.hamburger{
  width:30px; height:30px; border-radius:8px; border:1px solid rgba(255,255,255,0.14);
  background:rgba(255,255,255,0.06); display:flex; align-items:center; justify-content:center;
  cursor:pointer; flex-shrink:0; transition:transform .2s ease;
}
.hamburger:hover{ background:rgba(255,255,255,0.12); }
.hamburger svg{ width:15px; height:15px; }

.sidebar-backdrop{ display:none; }

.topbar-hamburger{
  width:34px; height:34px; border-radius:8px; border:1px solid var(--border-strong);
  background:var(--surface); display:none; align-items:center; justify-content:center;
  cursor:pointer; flex-shrink:0; color:var(--ink);
}
.topbar-hamburger svg{ width:16px; height:16px; }
.topbar-left{ display:flex; align-items:center; gap:12px; min-width:0; }

.sidebar-section-label{ font-size:10px; text-transform:uppercase; letter-spacing:0.8px; color:rgba(255,255,255,0.35); font-weight:800; padding:16px 20px 6px; }
.shell.collapsed .sidebar-section-label{ opacity:0; height:6px; padding:10px 0 0; overflow:hidden; }

.nav{ display:flex; flex-direction:column; gap:2px; padding:2px 10px; flex:1 1 auto; min-height:0; overflow-y:auto; overflow-x:hidden; scrollbar-width:thin; scrollbar-color:rgba(255,255,255,0.2) transparent; }
.nav::-webkit-scrollbar{ width:6px; }
.nav::-webkit-scrollbar-thumb{ background:rgba(255,255,255,0.18); border-radius:4px; }
.nav::-webkit-scrollbar-thumb:hover{ background:rgba(255,255,255,0.3); }
.nav-item{
  display:flex; align-items:center; gap:12px; padding:10px 10px; border-radius:9px;
  font-size:13.5px; font-weight:600; color:rgba(255,255,255,0.62); white-space:nowrap; cursor:pointer;
}
.nav-item svg{ width:18px; height:18px; flex-shrink:0; }
.nav-item:hover{ background:rgba(255,255,255,0.06); color:#fff; }
.nav-item.active{ background:var(--coral); color:#fff; }
.shell.collapsed .nav-item{ justify-content:center; padding:10px; }
.shell.collapsed .nav-label{ display:none; }

.nav-chevron{ width:14px !important; height:14px !important; margin-left:auto; flex-shrink:0; transition:transform .15s ease; opacity:.6; }
.nav-group.open > .nav-item .nav-chevron{ transform:rotate(180deg); }
.shell.collapsed .nav-chevron{ display:none; }

.nav-submenu{ display:none; flex-direction:column; gap:1px; padding:2px 0 4px 14px; margin-top:1px; border-left:1px solid rgba(255,255,255,0.1); margin-left:20px; }
.nav-group.open > .nav-submenu{ display:flex; }
.shell.collapsed .nav-submenu{ display:none !important; }
.nav-subitem{
  display:block; padding:7px 10px; border-radius:7px; font-size:12.5px; font-weight:600;
  color:rgba(255,255,255,0.5); white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.nav-subitem:hover{ background:rgba(255,255,255,0.06); color:#fff; }
.nav-subitem.active{ background:rgba(255,255,255,0.1); color:#fff; }
.nav-subitem-empty{ padding:7px 10px; font-size:12px; color:rgba(255,255,255,0.3); font-style:italic; }

.nav-subcategory-head{
  display:flex; align-items:center; justify-content:space-between; gap:6px; padding:7px 10px;
  border-radius:7px; font-size:11px; font-weight:800; text-transform:uppercase; letter-spacing:.4px;
  color:rgba(255,255,255,0.4); cursor:pointer;
}
.nav-subcategory-head:hover{ color:#fff; background:rgba(255,255,255,0.06); }
.nav-subcategory-head .nav-chevron{ width:11px !important; height:11px !important; opacity:.5; margin-left:0; }
.nav-subcategory.open > .nav-subcategory-head .nav-chevron{ transform:rotate(180deg); }
.nav-subcategory-list{ display:none; flex-direction:column; gap:1px; padding-left:6px; }
.nav-subcategory.open > .nav-subcategory-list{ display:flex; }

.sidebar-spacer{ flex:0 0 auto; }
.sidebar-foot{ padding:14px 16px; border-top:1px solid rgba(255,255,255,0.1); display:flex; align-items:center; gap:10px; }
.sidebar-foot .avatar{ width:30px; height:30px; border-radius:50%; background:var(--coral); display:flex; align-items:center; justify-content:center; font-weight:800; font-size:11.5px; color:#fff; flex-shrink:0; }
.sidebar-foot-info{ min-width:0; }
.shell.collapsed .sidebar-foot-info{ display:none; }
.sidebar-foot-name{ font-size:12.5px; font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sidebar-foot-role{ font-size:11px; color:rgba(255,255,255,0.45); font-weight:500; }

/* ---------- MAIN ---------- */
.main{ flex:1; min-width:0; }
.topbar{
  height:60px; display:flex; align-items:center; justify-content:space-between;
  padding:0 32px; border-bottom:1px solid var(--border); background:var(--surface);
}
.crumb{ font-size:12.5px; color:var(--ink-faint); font-weight:600; }
.crumb b{ color:var(--ink); font-weight:800; }
.topbar-right{ display:flex; align-items:center; gap:12px; }
.period-select{
  font-size:12.5px; color:var(--ink); font-weight:700; background:var(--bg); border:1px solid var(--border-strong);
  padding:7px 30px 7px 13px; border-radius:8px; cursor:pointer;
  appearance:none; -webkit-appearance:none; -moz-appearance:none;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat:no-repeat; background-position:right 12px center; background-size:9px 6px;
}

.content{ padding:28px 32px 48px; max-width:1600px; margin:0 auto; }

.page-head{ display:flex; align-items:flex-end; justify-content:space-between; margin-bottom:22px; flex-wrap:wrap; gap:12px; }
.page-head h1{ font-size:24px; font-weight:800; letter-spacing:-0.4px; }
.page-head p{ font-size:13px; color:var(--ink-dim); margin-top:4px; font-weight:500; }
.streak-pill{ display:flex; align-items:center; gap:8px; background:var(--coral-tint); color:var(--coral-dark); font-weight:700; font-size:12.5px; padding:8px 14px; border-radius:20px; border:1px solid #ffd7c4; white-space:nowrap; }
.streak-pill.pending{ background:var(--gold-tint); color:var(--gold); border-color:var(--gold); }
.streak-pill.on{ background:var(--green-tint); color:var(--green); border-color:var(--green); }
.streak-pill.off{ background:var(--red-tint); color:var(--red); border-color:var(--red); animation:conn-blink 1.4s ease-in-out infinite; }
.page-head-pills{ display:flex; flex-direction:column; align-items:flex-end; gap:8px; }

.summary-pills{ display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.summary-pill{ display:flex; align-items:center; gap:6px; font-size:12px; font-weight:700; padding:5px 12px; border-radius:20px; border:1px solid; white-space:nowrap; cursor:pointer; user-select:none; transition:transform .12s ease, box-shadow .12s ease; }
.summary-pill:hover{ transform:translateY(-1px); }
.summary-pill.active{ box-shadow:0 0 0 2px rgba(0,0,0,0.18) inset; }
.summary-pill.total{ background:var(--navy-tint); color:var(--navy); border-color:var(--navy); }
.summary-pill.on{ background:var(--green-tint); color:var(--green); border-color:var(--green); }
.summary-pill.off{ background:var(--red-tint); color:var(--red); border-color:var(--red); }

/* ---------- KPI ---------- */
.kpi-row{ display:grid; grid-template-columns:repeat(3,1fr); gap:16px; margin-bottom:20px; }
.kpi-card{ background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:20px 22px; position:relative; }
.kpi-card.hero{ background:var(--ink); border-color:var(--ink); }
.kpi-label{ font-size:12px; color:var(--ink-dim); font-weight:700; text-transform:uppercase; letter-spacing:0.5px; margin-bottom:12px; }
.kpi-card.hero .kpi-label{ color:rgba(255,255,255,0.55); }
.kpi-value{ font-size:36px; font-weight:800; letter-spacing:-1px; line-height:1; margin-bottom:12px; font-variant-numeric:tabular-nums; color:var(--ink); }
.kpi-card.hero .kpi-value{ color:#fff; }
.kpi-value.coral{ color:var(--coral); }
.kpi-delta{ display:inline-flex; align-items:center; gap:5px; font-size:12.5px; font-weight:700; padding:4px 9px; border-radius:20px; }
.kpi-delta.up{ color:var(--green); background:var(--green-tint); }
.kpi-delta.down{ color:var(--red); background:var(--red-tint); }
.kpi-card.hero .kpi-delta.up{ background:rgba(28,138,75,0.22); color:#6fe3a0; }
.kpi-foot{ font-size:11.5px; color:var(--ink-faint); margin-top:8px; font-weight:500; }
.kpi-card.hero .kpi-foot{ color:rgba(255,255,255,0.45); }
.kpi-edit-link{ background:none; border:none; padding:0; margin:0; font:inherit; font-size:11.5px; color:var(--ink-faint); text-decoration:underline; cursor:pointer; }
.kpi-edit-link:hover{ color:var(--ink-dim); }

/* ---------- FATURAMENTO (1ª / 2ª conversão) ---------- */
.fat-row{ display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:20px; }
.fat-card{ background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:20px 22px; }
.fat-card.pending{ border-color:var(--gold); background:var(--gold-tint); }
.fat-card-title{ font-size:12px; color:var(--ink-dim); font-weight:700; text-transform:uppercase; letter-spacing:0.5px; margin-bottom:16px; }
.fat-card.pending .fat-card-title{ color:var(--gold); }
.fat-stats{ display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:8px; }
.fat-stat-label{ font-size:11.5px; color:var(--ink-faint); font-weight:600; margin-bottom:6px; line-height:1.3; }
.fat-stat-value{ font-size:24px; font-weight:800; letter-spacing:-0.5px; color:var(--ink); font-variant-numeric:tabular-nums; }
.fat-stat-value.pending-dash{ color:var(--ink-faint); font-size:22px; }
.fat-card-total{ font-size:13px; color:var(--ink-dim); font-weight:700; padding-top:10px; margin-top:2px; border-top:1px dashed var(--border); }
.fat-card-total b{ color:var(--coral); font-size:15px; }
.fat-card-foot{ font-size:11.5px; color:var(--ink-faint); margin-top:8px; font-weight:500; }
@media (max-width:560px){ .fat-stats{ grid-template-columns:1fr; } }

/* ---------- POTENCIAL (simulador de ganho de conversão, arrastável) ---------- */
.pot-row{ display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:20px; }
.pot-card{ background:linear-gradient(135deg, #fb7185 0%, var(--coral) 100%); color:#fff; border-radius:14px; padding:20px 22px; }
.pot-card.disabled{ opacity:0.55; }
.pot-card-title{ font-size:12px; color:rgba(255,255,255,0.85); font-weight:700; text-transform:uppercase; letter-spacing:0.5px; margin-bottom:4px; }
.pot-card-sub{ font-size:11.5px; color:rgba(255,255,255,0.7); margin-bottom:18px; }
.pot-slider-head{ display:flex; align-items:baseline; justify-content:space-between; margin-bottom:10px; gap:10px; }
.pot-slider-label{ font-size:12.5px; color:rgba(255,255,255,0.85); font-weight:600; }
.pot-slider-pts{ font-size:17px; font-weight:800; color:#fff; font-variant-numeric:tabular-nums; text-align:right; white-space:nowrap; }
.pot-slider{ -webkit-appearance:none; appearance:none; width:100%; height:6px; border-radius:6px; background:rgba(255,255,255,0.35); outline:none; margin-bottom:20px; touch-action:pan-y; }
.pot-slider::-webkit-slider-thumb{ -webkit-appearance:none; appearance:none; width:24px; height:24px; border-radius:50%; background:var(--navy); border:3px solid #fff; box-shadow:0 2px 8px rgba(0,0,0,0.35); cursor:grab; }
.pot-slider::-moz-range-thumb{ width:24px; height:24px; border-radius:50%; background:var(--navy); border:3px solid #fff; box-shadow:0 2px 8px rgba(0,0,0,0.35); cursor:grab; }
.pot-result{ display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.pot-result-value{ font-size:24px; font-weight:800; letter-spacing:-0.5px; font-variant-numeric:tabular-nums; }
.pot-result-value.gain{ color:#fff; }
.pot-result-label{ font-size:11px; color:rgba(255,255,255,0.75); font-weight:600; margin-top:4px; }
@media (max-width:820px){ .pot-row{ grid-template-columns:1fr; } }

/* ---------- POTENCIAL: resumo combinado ---------- */
.pot-summary{ background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:20px 22px; margin-bottom:20px; }
.pot-summary:empty{ display:none; }
.pot-summary-title{ font-size:12px; color:var(--ink-dim); font-weight:700; text-transform:uppercase; letter-spacing:0.5px; margin-bottom:14px; }
.pot-summary-rows{ display:flex; flex-direction:column; gap:8px; margin-bottom:14px; }
.pot-summary-row{ display:flex; justify-content:space-between; gap:10px; font-size:13px; color:var(--ink-faint); font-weight:600; }
.pot-summary-row span:last-child{ color:var(--ink); font-weight:700; text-align:right; }
.pot-summary-total{ display:flex; justify-content:space-between; align-items:center; gap:10px; padding-top:14px; border-top:1px solid var(--border); }
.pot-summary-total span:first-child{ font-size:13px; font-weight:700; color:var(--ink-dim); }
.pot-summary-total span:last-child{ font-size:24px; font-weight:800; color:var(--coral); }

/* ---------- PANELS ---------- */
.panels-row{ display:grid; grid-template-columns:1.4fr 1fr; gap:16px; margin-bottom:20px; align-items:stretch; }
.panel{ background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:22px 24px; }
.panel-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:18px; gap:12px; }
.panel-title{ font-size:15.5px; font-weight:800; color:var(--ink); }
.panel-title-sub{ font-size:12px; color:var(--ink-faint); margin-top:2px; font-weight:500; }
.legend{ display:flex; gap:14px; }
.legend-item{ display:flex; align-items:center; gap:6px; font-size:12px; color:var(--ink-dim); font-weight:600; }
.legend-dot{ width:9px; height:9px; border-radius:2px; }

/* ---------- FUNNEL (formato funil real: cada etapa mais estreita que a anterior) ---------- */
.funnel-panel{ background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:22px 24px; margin-bottom:20px; }
.funnel{ display:flex; flex-direction:column; align-items:center; gap:0; margin-top:10px; }
.funnel-stage{ display:flex; flex-direction:column; align-items:center; margin:0 auto; }
.funnel-stage:nth-child(1){ width:100%; }
.funnel-stage:nth-child(2){ width:86%; }
.funnel-stage:nth-child(3){ width:72%; }
.funnel-stage:nth-child(4){ width:58%; }
.funnel-stage:nth-child(5){ width:44%; }
.funnel-shape{
  width:100%; height:88px; background:var(--coral); display:flex; flex-direction:column; align-items:center;
  justify-content:center; color:#fff; position:relative; clip-path:polygon(4% 0,96% 0,100% 100%,0% 100%);
  transition:opacity .6s ease; opacity:0;
}
.funnel-stage:nth-child(1) .funnel-shape{ background:var(--ink); }
.funnel-stage:nth-child(2) .funnel-shape{ background:#4a3128; }
.funnel-stage:nth-child(3) .funnel-shape{ background:var(--gold); }
.funnel-stage:nth-child(4) .funnel-shape{ background:var(--coral-dark); }
.funnel-stage:nth-child(5) .funnel-shape{ background:var(--coral); }
.funnel-shape.in{ opacity:1; }
.funnel-count{ font-family:var(--mono); font-size:21px; font-weight:800; font-variant-numeric:tabular-nums; }
.funnel-stage:nth-child(4) .funnel-count, .funnel-stage:nth-child(5) .funnel-count{ font-size:18px; }
.funnel-label{ font-size:11.5px; font-weight:700; margin-top:4px; opacity:0.9; text-align:center; padding:0 6px; }
.funnel-drop{
  background:var(--bg); border:1px solid var(--border-strong); border-radius:20px;
  font-size:10.5px; font-weight:800; color:var(--ink-dim); padding:3px 10px; white-space:nowrap; margin:6px 0;
}
.funnel-foot{ display:flex; gap:20px; margin-top:16px; flex-wrap:wrap; }
.funnel-foot-item{ font-size:12px; color:var(--ink-dim); font-weight:600; }
.funnel-foot-item b{ color:var(--ink); font-weight:800; }

/* ---------- RINGS ---------- */
.rings-row{ display:grid; grid-template-columns:repeat(3,1fr); gap:16px; margin-bottom:20px; }
.ring-card{ background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:20px; display:flex; align-items:center; gap:16px; }
.ring-svg{ width:84px; height:84px; flex-shrink:0; }
.ring-svg circle{ fill:none; stroke-width:9; }
.ring-track{ stroke:var(--border); }
.ring-bar{ stroke:var(--coral); stroke-linecap:round; transform:rotate(-90deg); transform-origin:50% 50%; transition:stroke-dashoffset 1.1s cubic-bezier(.22,.9,.3,1); }
.ring-card.green .ring-bar{ stroke:var(--green); }
.ring-card.navy .ring-bar{ stroke:var(--navy); }
.ring-pct{ position:relative; }
.ring-wrap{ position:relative; width:84px; height:84px; flex-shrink:0; }
.ring-center{ position:absolute; inset:0; display:flex; align-items:center; justify-content:center; font-family:var(--mono); font-weight:800; font-size:16px; }
.ring-info-label{ font-size:12px; font-weight:700; color:var(--ink-dim); text-transform:uppercase; letter-spacing:0.4px; }
.ring-info-value{ font-size:13.5px; font-weight:700; color:var(--ink); margin-top:4px; }
.ring-info-sub{ font-size:11.5px; color:var(--ink-faint); margin-top:2px; }

/* ---------- CHART BARS ---------- */
.chart-wrap{ height:190px; }
.bars{ display:flex; align-items:flex-end; gap:16px; width:100%; height:170px; }
.bar-col{ flex:1; min-width:0; display:flex; flex-direction:column; align-items:center; justify-content:flex-end; height:100%; gap:9px; }
.bar-stack{ width:100%; display:flex; justify-content:center; height:100%; align-items:flex-end; padding-top:22px; box-sizing:border-box; }
.bar{ position:relative; width:58%; border-radius:6px 6px 0 0; background:var(--coral); }
.bar.peak{ background:var(--gold); }
.bar-n{ position:absolute; bottom:100%; left:50%; transform:translateX(-50%); margin-bottom:5px; font-size:10.5px; font-weight:700; color:var(--ink-faint); white-space:nowrap; }
.bar.peak .bar-n{ color:var(--gold); }
.bar-x{ font-size:11px; line-height:1.35; color:var(--ink-faint); font-weight:600; }

/* Card genérico pra gráfico/estatística dentro de um .table-panel -- .table-panel sozinho não tem
   padding (pensado pra encostar a table nas bordas e deixar o padding pras células); qualquer
   conteúdo que não é <table> (gráfico, texto) precisa dessa respiração própria. */
.chart-panel{ padding:20px 22px; }

/* Grid de 4 gráficos lado a lado (Pré-conexão) -- extraído de inline style pra herdar breakpoint
   responsivo (senão o grid ficava fixo em 4 colunas até em tela de celular). */
.chart-grid-4{ grid-template-columns:repeat(4,1fr); }
@media (max-width:980px){ .chart-grid-4{ grid-template-columns:repeat(2,1fr); } }
@media (max-width:560px){ .chart-grid-4{ grid-template-columns:1fr; } }

/* ---------- HORIZONTAL BAR ROWS (fontes de captação etc) ---------- */
.hbar-row{ display:flex; align-items:center; gap:10px; margin-bottom:12px; }
.hbar-row:last-child{ margin-bottom:0; }
.hbar-label{ width:120px; flex-shrink:0; font-size:12.5px; font-weight:600; color:var(--ink); }
.hbar-track{ flex:1 1 auto; min-width:0; height:20px; background:var(--bg); border-radius:6px; overflow:hidden; }
.hbar-fill{ height:100%; border-radius:6px; }
.hbar-n{ width:32px; flex-shrink:0; font-size:12.5px; font-weight:700; color:var(--ink); text-align:right; }

/* ---------- LEADERBOARD ---------- */
.leaderboard{ display:flex; flex-direction:column; gap:10px; }
.lb-row{ display:flex; align-items:center; gap:12px; padding:10px 10px; border-radius:10px; }
.lb-row.rank1{ background:var(--coral-tint); }
.lb-rank{ font-family:var(--mono); font-weight:800; font-size:14px; color:var(--ink-faint); width:20px; text-align:center; }
.lb-row.rank1 .lb-rank{ color:var(--coral); }
.lb-avatar{ width:34px; height:34px; border-radius:9px; background:var(--navy-tint); color:var(--navy); display:flex; align-items:center; justify-content:center; font-weight:800; font-size:12px; flex-shrink:0; }
.lb-row.rank1 .lb-avatar{ background:var(--coral); color:#fff; }
.lb-info{ flex:1; min-width:0; }
.lb-name{ font-size:13px; font-weight:700; color:var(--ink); }
.lb-sub{ font-size:11px; color:var(--ink-faint); font-weight:500; }
.lb-val{ font-family:var(--mono); font-size:14px; font-weight:800; color:var(--ink); text-align:right; }
.lb-badge{ font-size:10px; font-weight:700; color:var(--green); }

/* ---------- TABLE ---------- */
.section-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; gap:12px; flex-wrap:wrap; }
.section-title{ font-size:17px; font-weight:800; color:var(--ink); }
.section-sub{ font-size:12.5px; color:var(--ink-faint); margin-top:2px; font-weight:500; }
.count-pill{ font-size:12px; font-weight:700; color:var(--coral-dark); background:var(--coral-tint); padding:5px 12px; border-radius:20px; border:1px solid #ffd7c4; }
.btn{ font-size:12.5px; font-weight:700; color:#fff; background:var(--coral); padding:9px 16px; border-radius:9px; border:none; cursor:pointer; display:inline-flex; align-items:center; gap:8px; }
.btn:hover{ background:var(--coral-dark); }
.btn.ghost{ background:transparent; color:var(--ink); border:1px solid var(--border-strong); }
.btn.ghost:hover{ background:var(--bg); }

.stage-filter{ display:flex; flex-wrap:wrap; gap:8px; margin-bottom:14px; }
.stage-pill{ font-size:12px; font-weight:700; padding:6px 14px; border-radius:20px; border:1px solid var(--border-strong); background:var(--surface); color:var(--ink-faint); cursor:pointer; display:inline-flex; align-items:center; gap:6px; transition:filter .15s, background .15s, color .15s, border-color .15s; }
.stage-pill:hover{ filter:brightness(0.97); }
.stage-pill .stage-pill-dot{ width:7px; height:7px; border-radius:50%; background:currentColor; opacity:.85; }
.stage-pill.active{ color:#fff; border-color:transparent; }
.stage-pill.active .stage-pill-dot{ background:#fff; }

.table-panel{ background:var(--surface); border:1px solid var(--border); border-radius:14px; overflow:hidden; overflow-x:auto; }
table{ width:100%; border-collapse:collapse; min-width:640px; }
thead th{ text-align:left; font-size:11px; text-transform:uppercase; letter-spacing:0.5px; color:var(--ink-faint); font-weight:800; padding:14px 20px; border-bottom:1px solid var(--border); background:#fcfaf7; }
thead th.num{ text-align:right; }
tbody td{ padding:14px 20px; border-bottom:1px solid var(--border); font-size:13.5px; color:var(--ink); }
tbody tr:last-child td{ border-bottom:none; }
tbody tr:hover{ background:#fffaf7; }
td.num{ text-align:right; font-family:var(--mono); font-variant-numeric:tabular-nums; font-weight:700; color:var(--ink); }
.lead-name{ font-weight:700; }
.lead-clinic-cell{ color:var(--ink-dim); font-weight:500; }
.date-cell{ color:var(--ink-dim); font-weight:500; }

.badge{ display:inline-flex; align-items:center; gap:6px; font-size:12px; font-weight:800; padding:5px 11px; border-radius:20px; white-space:nowrap; }
.badge-dot{ width:6px; height:6px; border-radius:50%; }
.badge.novo{ color:var(--navy); background:var(--navy-tint); }
.badge.novo .badge-dot{ background:var(--navy); }
.badge.contato{ color:var(--gold); background:var(--gold-tint); }
.badge.contato .badge-dot{ background:var(--gold); }
.badge.qualificado{ color:var(--coral-dark); background:var(--coral-tint); }
.badge.qualificado .badge-dot{ background:var(--coral); }
.badge.fechado{ color:var(--green); background:var(--green-tint); }
.badge.fechado .badge-dot{ background:var(--green); }
.badge.perdido{ color:var(--red); background:var(--red-tint); }
.badge.perdido .badge-dot{ background:var(--red); }
.badge.ativo{ color:var(--green); background:var(--green-tint); }
.badge.ativo .badge-dot{ background:var(--green); }
.badge.onboarding{ color:var(--gold); background:var(--gold-tint); }
.badge.onboarding .badge-dot{ background:var(--gold); }
.badge.admin{ color:var(--coral-dark); background:var(--coral-tint); }
.badge.admin .badge-dot{ background:var(--coral); }
.badge.operador{ color:var(--navy); background:var(--navy-tint); }
.badge.operador .badge-dot{ background:var(--navy); }

.conn-status{ display:inline-flex; align-items:center; gap:6px; font-size:10.5px; font-weight:800; letter-spacing:.03em; margin-bottom:2px; }
.conn-status .conn-dot{ width:8px; height:8px; border-radius:50%; flex:none; animation:conn-blink 1.4s ease-in-out infinite; }
.conn-status.on{ color:var(--green); }
.conn-status.on .conn-dot{ background:var(--green); }
.conn-status.off{ color:var(--red); }
.conn-status.off .conn-dot{ background:var(--red); }
@keyframes conn-blink{ 0%,100%{ opacity:1; } 50%{ opacity:.25; } }

/* ---------- CLINIC CARDS ---------- */
.clinic-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:16px; }
.clinic-card{ position:relative; background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:20px; display:flex; flex-direction:column; gap:14px; cursor:pointer; transition:border-color .15s ease, transform .15s ease; }
.clinic-card:hover{ border-color:var(--coral); transform:translateY(-2px); }
.clinic-card.disabled{ cursor:default; opacity:0.6; }
.clinic-card.disabled:hover{ border-color:var(--border); transform:none; }
.clinic-delete-btn{ position:absolute; top:12px; right:12px; width:28px; height:28px; border-radius:8px; border:none; background:transparent; color:var(--ink-faint); display:flex; align-items:center; justify-content:center; cursor:pointer; transition:background .15s ease, color .15s ease; }
.clinic-delete-btn:hover{ background:var(--red-tint); color:var(--red); }
.clinic-edit-btn{ position:absolute; top:12px; right:44px; width:28px; height:28px; border-radius:8px; border:none; background:transparent; color:var(--ink-faint); display:flex; align-items:center; justify-content:center; cursor:pointer; transition:background .15s ease, color .15s ease; }
.clinic-edit-btn:hover{ background:var(--coral-tint); color:var(--coral); }
.modal .field-value{ font-size:14px; font-weight:700; color:var(--ink); margin-bottom:2px; }
.otp-code-input{ width:100%; box-sizing:border-box; padding:12px 13px; font-size:22px; letter-spacing:6px; text-align:center; font-family:var(--mono); border:1px solid var(--border-strong); border-radius:8px; }
.btn.danger{ background:var(--red); }
.btn.danger:hover{ background:#a91f31; }
.modal-error{ font-size:12px; color:var(--red); margin-top:10px; display:none; }
.modal-error.show{ display:block; }
.clinic-card-top{ display:flex; align-items:center; gap:12px; }
.clinic-avatar{ width:42px; height:42px; border-radius:11px; background:var(--navy-tint); color:var(--navy); display:flex; align-items:center; justify-content:center; font-weight:800; font-size:14px; flex-shrink:0; }
.clinic-card.featured .clinic-avatar{ background:var(--coral); color:#fff; }
.clinic-name{ font-size:14.5px; font-weight:800; color:var(--ink); }
.clinic-sub{ font-size:11.5px; color:var(--ink-faint); font-weight:500; }
.clinic-metrics{ display:flex; gap:18px; }
.clinic-metric{ flex:1; }
.clinic-metric-value{ font-family:var(--mono); font-size:17px; font-weight:800; color:var(--ink); }
.clinic-metric-label{ font-size:10.5px; color:var(--ink-faint); font-weight:700; text-transform:uppercase; letter-spacing:0.3px; margin-top:2px; }

/* ---------- TEAM ---------- */
.team-toolbar{ display:flex; justify-content:flex-end; margin-bottom:14px; }
.member-cell{ display:flex; align-items:center; gap:10px; }
.member-avatar{ width:32px; height:32px; border-radius:50%; background:var(--navy-tint); color:var(--navy); display:flex; align-items:center; justify-content:center; font-weight:800; font-size:11px; flex-shrink:0; }
.member-name{ font-weight:700; }
.member-email{ font-size:11.5px; color:var(--ink-faint); font-weight:500; }

.modal-backdrop{ position:fixed; inset:0; background:rgba(32,26,22,0.45); display:none; align-items:center; justify-content:center; z-index:50; }
.modal-backdrop.open{ display:flex; }
.modal{ background:var(--surface); border-radius:16px; padding:26px; width:380px; max-width:calc(100vw - 40px); box-shadow:0 20px 60px rgba(0,0,0,0.25); }
.modal h3{ font-size:16px; font-weight:800; margin-bottom:16px; }
.field{ margin-bottom:14px; }
.field label{ display:block; font-size:11.5px; font-weight:700; color:var(--ink-dim); text-transform:uppercase; letter-spacing:0.3px; margin-bottom:6px; }
.field input, .field select{ width:100%; padding:9px 11px; border:1px solid var(--border-strong); border-radius:8px; font-size:13.5px; font-family:var(--sans); background:var(--bg); }
.field-note{ font-size:11.5px; color:var(--ink-faint); font-weight:500; margin:-6px 0 14px; line-height:1.4; }
.modal-actions{ display:flex; justify-content:flex-end; gap:10px; margin-top:18px; }

/* ---------- ADD CLINIC CARD + WIZARD ---------- */
.clinic-card.add-card{
  align-items:center; justify-content:center; text-align:center; gap:10px; min-height:184px;
  border:2px dashed var(--border-strong); background:transparent;
}
.clinic-card.add-card:hover{ border-color:var(--coral); background:var(--coral-tint); transform:translateY(-2px); }
.add-card-icon{
  width:44px; height:44px; border-radius:50%; background:var(--coral-tint); color:var(--coral);
  display:flex; align-items:center; justify-content:center; font-size:24px; font-weight:800; line-height:1;
}
.add-card-title{ font-size:14px; font-weight:800; color:var(--ink); }
.add-card-sub{ font-size:11.5px; color:var(--ink-faint); font-weight:500; max-width:220px; }

.modal.wide{ width:420px; }
.wizard-steps{ display:flex; gap:6px; margin-bottom:18px; }
.wizard-step-dot{ flex:1; height:4px; border-radius:3px; background:var(--border); }
.wizard-step-dot.done, .wizard-step-dot.active{ background:var(--coral); }
.wizard-panel{ display:none; }
.wizard-panel.active{ display:block; }
.qr-box{ display:flex; flex-direction:column; align-items:center; gap:14px; padding:4px 0 10px; }
.qr-render{ width:172px; height:172px; display:flex; align-items:center; justify-content:center; overflow:hidden; border-radius:10px; }
.qr-render svg, .qr-render img{ width:100%; height:100%; object-fit:contain; }
.qr-clinic-name{ font-size:15px; font-weight:800; text-align:center; }
.link-copy-row{ display:flex; gap:8px; width:100%; }
.link-copy-row input{ flex:1; min-width:0; padding:9px 11px; border:1px solid var(--border-strong); border-radius:8px; font-size:11.5px; font-family:var(--mono); background:var(--bg); color:var(--ink-dim); }
.connect-status{ display:flex; align-items:center; gap:8px; font-size:12.5px; font-weight:700; color:var(--ink-dim); background:var(--bg); border:1px solid var(--border); border-radius:10px; padding:10px 12px; width:100%; }
.connect-status .dot{ width:8px; height:8px; border-radius:50%; background:var(--gold); flex-shrink:0; animation:gapi-pulse 1.4s ease-in-out infinite; }
.connect-status.connected{ color:var(--green); background:var(--green-tint); border-color:#bfe6cd; }
.connect-status.connected .dot{ background:var(--green); animation:none; }
@keyframes gapi-pulse{ 0%,100%{opacity:1;} 50%{opacity:.35;} }
.sim-note{ font-size:10.5px; color:var(--ink-faint); font-weight:500; margin-top:-4px; text-align:center; }
.btn[disabled]{ opacity:0.4; cursor:not-allowed; }
.btn[disabled]:hover{ background:var(--coral); }

/* ---------- EMPTY STATE (dados pendentes de conexão real) ---------- */
.empty-state{
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  text-align:center; padding:34px 20px; gap:5px;
}
.empty-state-icon{
  width:38px; height:38px; border-radius:50%; background:var(--bg); border:1px solid var(--border-strong);
  display:flex; align-items:center; justify-content:center; margin-bottom:6px; color:var(--ink-faint);
}
.empty-state-icon svg{ width:18px; height:18px; }
.empty-state-title{ font-size:13px; font-weight:800; color:var(--ink-dim); }
.empty-state-sub{ font-size:11.5px; color:var(--ink-faint); font-weight:500; max-width:300px; }
.pending-dash{ color:var(--ink-faint); }
.kpi-foot.pending{ color:var(--gold); font-weight:700; }

/* ---------- SPOTLIGHT (clínica única em destaque) ---------- */
.spotlight-card{ display:flex; align-items:flex-start; gap:16px; border-radius:12px; transition:transform .15s ease; }
.spotlight-card:hover{ transform:translateY(-2px); }
.spotlight-avatar{ width:52px; height:52px; border-radius:13px; background:var(--coral); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:800; font-size:17px; flex-shrink:0; }
.spotlight-info{ flex:1; min-width:0; }
.spotlight-name{ font-size:15px; font-weight:800; color:var(--ink); }
.spotlight-sub{ font-size:12px; color:var(--ink-faint); font-weight:600; margin-top:2px; }
.spotlight-metrics{ display:flex; gap:22px; margin-top:14px; flex-wrap:wrap; }
.spotlight-metric-value{ font-family:var(--mono); font-weight:800; font-size:16px; color:var(--ink); }
.spotlight-metric-label{ font-size:10px; color:var(--ink-faint); font-weight:700; text-transform:uppercase; letter-spacing:0.3px; margin-top:2px; }

@media (max-width: 980px){
  .kpi-row{ grid-template-columns:repeat(2,1fr); }
  .fat-row{ grid-template-columns:1fr; }
  .panels-row{ grid-template-columns:1fr; }
  .rings-row{ grid-template-columns:1fr; }
  .clinic-grid{ grid-template-columns:1fr; }
}

/* ---------- MOBILE: sidebar vira gaveta (drawer) sobreposta, não empurra o conteúdo ---------- */
@media (max-width: 880px){
  .topbar-hamburger{ display:flex; }
  .sidebar{
    position:fixed; top:0; left:0; height:100vh; z-index:200; width:264px;
    transform:translateX(-100%); transition:transform .26s ease;
  }
  .shell.mobile-open .sidebar{ transform:translateX(0); box-shadow:10px 0 36px rgba(0,0,0,0.18); }
  .shell.mobile-open .hamburger svg{ transform:rotate(90deg); }
  .sidebar-backdrop{
    display:block; position:fixed; inset:0; background:rgba(20,16,13,0.42); z-index:150;
    opacity:0; pointer-events:none; transition:opacity .26s ease;
  }
  .shell.mobile-open .sidebar-backdrop{ opacity:1; pointer-events:auto; }
  .main{ width:100%; }
  .topbar{ padding:0 16px; }
  .content{ padding:18px 16px 40px; }
  .page-head h1{ font-size:20px; }
  .kpi-row{ grid-template-columns:1fr; }
  .modal.wide{ width:calc(100vw - 40px); }
}

/* ---------- SETTINGS ---------- */
.settings-stack{ display:flex; flex-direction:column; gap:16px; max-width:760px; }
.settings-panel{ background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:22px 24px; }
.settings-panel-title{ font-size:15px; font-weight:800; }
.settings-panel-sub{ font-size:12px; color:var(--ink-dim); margin-top:2px; margin-bottom:16px; }
.setting-row{ display:flex; align-items:center; justify-content:space-between; gap:16px; padding:12px 0; border-top:1px solid var(--border); }
.setting-row:first-of-type{ border-top:none; padding-top:0; }
.setting-row-label{ font-size:13px; font-weight:700; }
.setting-row-sub{ font-size:11.5px; color:var(--ink-faint); margin-top:2px; }
.switch{ position:relative; width:42px; height:24px; flex-shrink:0; }
.switch input{ opacity:0; width:0; height:0; }
.switch-track{ position:absolute; inset:0; background:var(--border-strong); border-radius:20px; cursor:pointer; transition:background .18s ease; }
.switch-track::before{ content:""; position:absolute; width:18px; height:18px; left:3px; top:3px; background:#fff; border-radius:50%; transition:transform .18s ease; box-shadow:0 1px 3px rgba(0,0,0,0.25); }
.switch input:checked + .switch-track{ background:var(--green); }
.switch input:checked + .switch-track::before{ transform:translateX(18px); }
.settings-field-row{ display:flex; gap:12px; flex-wrap:wrap; }
.settings-field-row .field{ flex:1; min-width:200px; }
.integration-row{ display:flex; align-items:center; gap:12px; padding:12px 0; border-top:1px solid var(--border); }
.integration-row:first-of-type{ border-top:none; padding-top:0; }
.integration-icon{ width:38px; height:38px; border-radius:10px; background:var(--bg); border:1px solid var(--border); display:flex; align-items:center; justify-content:center; font-weight:800; font-size:13px; flex-shrink:0; }
.integration-info{ flex:1; }
.integration-name{ font-size:13px; font-weight:700; }
.integration-sub{ font-size:11.5px; color:var(--ink-faint); margin-top:1px; }

/* ---------- MODAL DE LEAD (histórico + conversa real + análise IA) ---------- */
.lead-modal{ position:relative; width:560px; max-width:calc(100vw - 32px); max-height:calc(100vh - 60px); overflow-y:auto; }
.lead-modal .close{ position:absolute; top:16px; right:16px; background:var(--bg); width:32px; height:32px; border-radius:50%; display:flex; align-items:center; justify-content:center; color:var(--ink-dim); cursor:pointer; border:none; padding:0; font-size:16px; }
.lead-modal h3{ padding-right:40px; margin-bottom:2px; }
.lead-modal .mp{ color:var(--ink-dim); font-size:12.5px; margin-bottom:14px; }
.crm-btn{ display:inline-flex; align-items:center; gap:6px; background:var(--green); color:#fff; font-weight:700; font-size:12.5px; padding:9px 14px; border-radius:10px; margin-bottom:16px; }
.crm-btn.disabled{ background:var(--surface-2, var(--bg)); color:var(--ink-faint); pointer-events:none; }
.modal-tabs2{ display:flex; gap:3px; background:var(--bg); border:1px solid var(--border); border-radius:12px; padding:3px; margin-bottom:16px; }
.modal-tab2{ flex:1; text-align:center; padding:8px 6px; border-radius:9px; font-size:12.5px; font-weight:700; color:var(--ink-dim); cursor:pointer; user-select:none; }
.modal-tab2.active{ background:var(--ink); color:#fff; }
.modal-pane2{ display:none; }
.modal-pane2.active{ display:block; }
.timeline{ display:flex; flex-direction:column; border-left:2px solid var(--border); padding-left:16px; margin-left:4px; max-height:320px; overflow-y:auto; }
.titem{ position:relative; padding-bottom:16px; }
.titem:last-child{ padding-bottom:0; }
.titem::before{ content:""; position:absolute; left:-21px; top:3px; width:9px; height:9px; border-radius:50%; background:var(--coral); border:2px solid var(--surface); }
.titem b{ font-size:12.5px; color:var(--ink); }
.titem .dt{ font-size:11px; color:var(--ink-faint); margin-left:6px; }
.titem .txt{ font-size:12px; color:var(--ink-dim); margin-top:3px; line-height:1.5; }
.chat-wrap{ display:flex; flex-direction:column; gap:8px; max-height:320px; overflow-y:auto; padding:6px 4px; margin-bottom:14px; }
.bubble{ max-width:80%; padding:9px 13px; border-radius:14px; font-size:12.5px; line-height:1.45; word-break:break-word; }
.bubble.in{ align-self:flex-start; background:var(--bg); color:var(--ink); border-bottom-left-radius:4px; }
.bubble.out{ align-self:flex-end; background:var(--ink); color:#fff; border-bottom-right-radius:4px; }
.bubble .t{ display:block; font-size:10px; opacity:.6; margin-top:4px; }
.chat-empty,.chat-loading{ font-size:12px; color:var(--ink-faint); text-align:center; padding:24px 8px; }
.analise-btn{ display:inline-flex; align-items:center; gap:6px; background:var(--coral); border:none; color:#fff; font-weight:700; font-size:12.5px; padding:10px 14px; border-radius:11px; cursor:pointer; width:100%; justify-content:center; }
.analise-btn:hover{ background:var(--coral-dark); }
.analise-btn:disabled{ opacity:.6; cursor:default; }
.analise-card{ background:var(--bg); border-radius:12px; padding:14px; margin-top:12px; font-size:12.5px; line-height:1.6; color:var(--ink); }
tr.lead-row{ cursor:pointer; }
tr.lead-row:hover{ background:var(--bg); }
@media (max-width:640px){
  .lead-modal .close{ width:44px; height:44px; font-size:18px; }
}
