:root {
  --bg: #FAF9F5;
  --surface: #ffffff;
  --border: #E6E3D9;
  --text: #141413;
  --muted: #73726C;
  --brand: #157A50;
  --brand-2: #E3F1E9;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --ok: #067647;
  --ok-bg: #e6f4ec;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1418; --surface: #161d22; --border: #26323a; --text: #e8edf1; --muted: #9aa8b4;
    --brand: #4fc3a1; --brand-2: #173029; --danger: #f97066; --danger-bg: #3a1c1a; --ok: #47cd89; --ok-bg: #12301f;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.55 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--text);
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font: 500 28px/1.15 "Source Serif 4", Georgia, serif; letter-spacing: -0.01em; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Layout logado */
.shell { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--border); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; }
.logo { font-weight: 700; font-size: 18px; padding: 0 10px 18px; color: var(--text); }
.logo span { color: var(--brand); }
.logo { display: flex; align-items: center; }
.logo-icon { width: 30px; height: 30px; border-radius: 8px; margin-right: 8px; }
.side a.nav { display: block; padding: 9px 10px; border-radius: 8px; color: var(--text); }
.side a.nav:hover { background: var(--bg); text-decoration: none; }
.side a.nav.on { background: var(--brand-2); color: var(--brand); font-weight: 600; }
.side .foot { margin-top: auto; padding: 10px; font-size: 13px; color: var(--muted); }
.main { padding: 28px 32px; max-width: 1180px; width: 100%; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }

/* Componentes */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g2 { grid-template-columns: repeat(2, 1fr); }
.stat .n { font-size: 26px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 13px; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--brand);
  background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.block { width: 100%; justify-content: center; }
form.inline { display: inline; }
label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 4px; }
input, select, textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-2); border-color: var(--brand); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--bg); border: 1px solid var(--border); }
.tag.on { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.tag.off { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.erro { background: var(--danger-bg); color: var(--danger); }
.ok-text { color: var(--ok); font-weight: 600; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { padding: 6px 12px; border-radius: 99px; border: 1px solid var(--border); color: var(--text); font-size: 13px; }
.tabs a.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.steps li { margin-bottom: 6px; }

/* Conversa */
.chat { display: flex; flex-direction: column; gap: 8px; max-height: 62vh; overflow-y: auto; padding: 4px; }
.bubble { max-width: 72%; padding: 8px 12px; border-radius: 12px; white-space: pre-wrap; word-wrap: break-word; }
.bubble.in { background: var(--bg); align-self: flex-start; border: 1px solid var(--border); }
.bubble.out { background: var(--brand-2); align-self: flex-end; }
.bubble .meta { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.qr { width: 260px; height: 260px; image-rendering: pixelated; border-radius: 8px; background: #fff; padding: 8px; }

/* Páginas públicas */
.public { max-width: 1040px; margin: 0 auto; padding: 24px 20px 60px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px; }
.hero { text-align: center; max-width: 680px; margin: 0 auto 40px; }
.hero h1 { font-size: 34px; line-height: 1.2; margin-bottom: 12px; }
.hero p { font-size: 17px; color: var(--muted); }
.auth { max-width: 400px; margin: 40px auto; }
.price { font-size: 32px; font-weight: 700; margin: 8px 0; }
.price small { font-size: 14px; color: var(--muted); font-weight: 500; }
.plan ul { padding-left: 18px; margin: 12px 0 20px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 16px 0 4px; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.qr-svg svg { width: 200px; height: 200px; border-radius: 8px; }
.codes { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; font-size: 16px; line-height: 1.8; columns: 2; }
code { background: var(--bg); padding: 2px 6px; border-radius: 4px; word-break: break-all; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.file-row a { flex: 1; word-break: break-all; }
.plan { position: relative; }
.plan.featured { border: 2px solid var(--brand); box-shadow: 0 8px 24px rgba(15, 95, 76, .12); }
.ribbon { position: absolute; top: -12px; right: 20px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 99px; }
.highlight { background: var(--brand-2); color: var(--brand); padding: 10px 12px; border-radius: 8px; font-size: 14px; font-weight: 600; margin: 14px 0; }
.compare td:not(:first-child), .compare th:not(:first-child) { text-align: center; width: 130px; }
.compare .yes { color: var(--ok); font-weight: 700; }
.compare .no { color: var(--muted); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--border); padding: 10px 12px; }
  .logo { width: 100%; padding-bottom: 6px; }
  .side .foot { display: none; }
  .main { padding: 18px 16px; }
  .g4 { grid-template-columns: repeat(2, 1fr); }
  .g2 { grid-template-columns: 1fr; }
  .bubble { max-width: 90%; }
  table { font-size: 14px; }
  .hide-sm { display: none; }
}

.install-steps { counter-reset: s; list-style: none; padding: 0; }
.install-steps li { counter-increment: s; position: relative; padding: 10px 0 10px 44px; border-bottom: 1px solid var(--border); }
.install-steps li::before { content: counter(s); position: absolute; left: 0; top: 8px; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.app-preview { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.app-preview img { width: 84px; height: 84px; border-radius: 19px; box-shadow: 0 6px 18px rgba(0,0,0,.18); }

/* campo de envio de arquivos */
.upload { position: relative; margin-bottom: 12px; }
.upload input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-box { display: flex; flex-direction: column; gap: 4px; align-items: center; text-align: center; cursor: pointer;
  padding: 18px 14px; border: 2px dashed var(--brand); border-radius: 10px; background: var(--brand-2); color: var(--brand); font-weight: 400; }
.upload-box strong { font-size: 15px; }
.upload input[type=file]:focus-visible + .upload-box { outline: 2px solid var(--brand); outline-offset: 2px; }

/* logo: W girado para a esquerda que vira funil */
.logo-mark { width: 30px; height: 30px; border-radius: 8px; margin-right: 8px; background: #0B1712; flex: none; }
.logo-mark .giro { transform-origin: 60px 60px; }
.logo-anim .giro { animation: wgiro 1.4s cubic-bezier(.6, 0, .2, 1) .3s both; }
/* começa com o W em pé e gira 90° para a esquerda (sentido anti-horário) */
@keyframes wgiro { from { transform: rotate(90deg); } to { transform: rotate(0deg); } }
@media (prefers-reduced-motion: reduce) { .logo-anim .giro { animation: none; } }

/* ---------- Relatórios ---------- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 14px; }
.chip:hover { text-decoration: none; border-color: var(--brand); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); }
.kpi-label { font-size: 13px; color: var(--muted); }
.kpi strong { font-family: "Source Serif 4", Georgia, serif; font-size: 34px; font-weight: 500; line-height: 1.1; letter-spacing: -0.01em; }
.kpi-sub { font-size: 12px; color: var(--muted); }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.dash-grid h2 { font-size: 17px; font-weight: 500; margin: 0 0 2px; }
.funil-card { grid-row: span 2; }
.funil { list-style: none; padding: 0; margin: 16px 0 8px; display: grid; gap: 14px; }
.etapa-top { display: flex; justify-content: space-between; align-items: baseline; }
.etapa-nome { font-weight: 500; }
.etapa-n { font-size: 22px; font-weight: 500; }
.barra { height: 14px; border-radius: 7px; background: var(--brand-2); overflow: hidden; margin: 6px 0 4px; }
.barra span { display: block; height: 100%; border-radius: 7px; background: var(--brand); }
/* uma cor só, ficando mais escura conforme o lead avança no funil */
.e1 .barra span { background: #8fdcb7; } .e2 .barra span { background: #5cc796; } .e3 .barra span { background: #2fae76; }
.e4 .barra span { background: #17935f; } .e5 .barra span { background: #0b6b44; }
.etapa-pe { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.conv { color: var(--text); }
.tabela-dados table { width: 100%; font-size: 14px; margin-top: 8px; }
.chart { width: 100%; height: auto; display: block; margin-top: 8px; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .ax { font-size: 11px; fill: var(--muted); font-family: inherit; }
.chart .bar { fill: #2fae76; }
.chart .hit { fill: transparent; }
.chart .col:hover .bar { fill: #0b6b44; }
.chart .col:hover .hit { fill: rgba(23, 147, 95, .06); }
.hbar { display: grid; grid-template-columns: minmax(0, 1.2fr) 1.5fr 36px; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.hbar:last-child { border-bottom: 0; }
.hbar-nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-trilho { height: 10px; border-radius: 5px; background: var(--brand-2); overflow: hidden; }
.hbar-trilho span { display: block; height: 100%; border-radius: 5px; background: #2fae76; min-width: 4px; }
.hbar-n { text-align: right; font-weight: 500; }
@media (prefers-color-scheme: dark) {
  .e1 .barra span { background: #2a6b4f; } .e2 .barra span { background: #33885f; } .e3 .barra span { background: #3fa673; }
  .e4 .barra span { background: #55c28b; } .e5 .barra span { background: #8fe0b6; }
  .chart .bar, .hbar-trilho span { fill: #55c28b; background: #55c28b; }
  .chart .col:hover .bar { fill: #8fe0b6; }
}
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dash-grid { grid-template-columns: 1fr; } .funil-card { grid-row: auto; } }

/* ---------- Rentabilidade ---------- */
.tabela-rolagem { overflow-x: auto; }
table.num td, table.num th { text-align: right; white-space: nowrap; }
table.num td:first-child, table.num th:first-child { text-align: left; white-space: normal; }
table.num tr.destaque td { background: var(--brand-2); }
.neg { color: var(--danger); }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input.mini { width: 90px; text-align: right; }
.uso-aviso { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
@media (max-width: 900px) { .form-grid { grid-template-columns: 1fr; } }
