/* Painel do quiz — framed-sheet, light, IBM Plex Sans.
   Colour lives on data. Chrome stays grey. One accent: teal #1b6c80. */

:root {
  --ink: #141414;
  --muted: #5c5c5c;
  --faint: #8a8a8a;
  --line: #e8eaec;
  --line-strong: #d6d6d2;
  --ground: #f7f6f2;
  --sheet: #ffffff;
  --accent: #1b6c80;
  --accent-soft: #edf3f4;
  --queda: #8a3d3d;
  --ok: #1b6c80;
  --focus: #1b6c80;
  --sidebar: 228px;
  --topbar: 48px;
  --gap: 24px;
  --inset: 8px;
  --radius: 16px;
  --font: "IBM Plex Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--ground); color: var(--ink); }
body {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 400;
  line-height: 22px;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "kern", "liga";
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
code {
  font-family: var(--font);
  font-size: 12px;
  background: var(--accent-soft);
  padding: 1px 5px;
  border-radius: 3px;
}

h1, h2, h3, h4 { margin: 0; font-weight: 500; letter-spacing: -0.01em; color: var(--ink); }
h1 { font-size: 22px; line-height: 28px; }
h2 { font-size: 15px; line-height: 22px; }
h3 { font-size: 14px; line-height: 22px; }

.num, .kpi-valor, .path-n, .stat {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background: var(--ground);
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px 32px 32px;
}
.login-mark {
  width: 20px;
  height: 20px;
  margin-bottom: 20px;
  color: var(--ink);
}
.login-card h1 { font-size: 22px; line-height: 28px; font-weight: 500; }
.login-card .lede {
  margin: 8px 0 28px;
  color: var(--muted);
  font-size: 13px;
  line-height: 20px;
}
.login-card label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}
.login-card input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0 12px;
  background: var(--sheet);
  outline: none;
}
.login-card input:focus { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.login-card button[type="submit"] {
  display: block;
  width: 100%;
  height: 36px;
  margin-top: 16px;
  background: var(--ink);
  color: #fff;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
}
.login-card button[type="submit"]:hover { background: #000; }
.login-erro {
  min-height: 20px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--queda);
}

/* ---------- frame (desktop) ---------- */
.app { min-height: 100vh; background: var(--ground); }
.frame {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  grid-template-rows: var(--topbar) 1fr;
  min-height: 100vh;
}
.sidebar {
  grid-row: 1 / -1;
  background: var(--ground);
  padding: 16px 12px 24px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.topbar {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px 0 24px;
  background: var(--ground);
  min-width: 0;
}
.sheet {
  grid-column: 2;
  grid-row: 2;
  margin: 0 var(--inset) var(--inset) 0;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: auto;
  min-height: 0;
  min-width: 0;
}
.canvas { padding: 28px 32px 48px; }

.phone-bar, .nav-overlay { display: none; }

/* ---------- brand + nav ---------- */
.brand {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 4px 8px 20px;
}
.brand-mark {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  color: var(--ink);
}
.brand strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
  letter-spacing: -0.01em;
}
.brand span {
  display: block;
  font-size: 11px;
  line-height: 16px;
  color: var(--muted);
  font-weight: 400;
  margin-top: 2px;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  text-align: left;
  line-height: 32px;
}
.menu button svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--faint);
}
.menu button:hover { color: var(--ink); background: rgba(20, 20, 20, 0.04); }
.menu button:hover svg { color: var(--ink); }
.menu button.ativo {
  color: var(--ink);
  font-weight: 500;
  background: rgba(20, 20, 20, 0.06);
}
.menu button.ativo svg { color: var(--ink); }

/* ---------- top bar ---------- */
.topbar-scope {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.topbar-dir {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 0 0 auto;
}
.atualizado {
  font-size: 12px;
  color: var(--faint);
  white-space: nowrap;
}
.btn {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--sheet);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.btn:hover { background: #f3f2ee; }
.btn:focus-visible,
.menu button:focus-visible,
.tabs button:focus-visible,
select:focus-visible,
.link:focus-visible,
.btn-menu:focus-visible {
  outline: 1px solid var(--focus);
  outline-offset: 2px;
}

/* ---------- page head + finding ---------- */
.page-head { margin-bottom: 8px; }
.page-head h1 { font-weight: 500; }
.finding {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 20px;
  color: var(--muted);
  max-width: 56ch;
}
.aviso {
  margin: 16px 0 0;
  font-size: 13px;
  line-height: 20px;
  color: var(--muted);
  max-width: 62ch;
}

/* ---------- scope: country tabs + filters ---------- */
.scope {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  margin: 20px 0 0;
  padding-bottom: 4px;
}
.tabs {
  display: flex;
  gap: 0;
  margin-right: auto;
}
.tabs button {
  height: 32px;
  padding: 0 2px;
  margin-right: 16px;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  border-radius: 0;
}
.tabs button:hover { color: var(--ink); }
.tabs button.ativo {
  color: var(--ink);
  font-weight: 500;
  border-bottom-color: var(--ink);
}

.filtros {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}
.campo { display: flex; flex-direction: column; gap: 4px; min-width: 140px; }
.campo label {
  font-size: 11px;
  font-weight: 500;
  color: var(--faint);
  letter-spacing: 0.01em;
}
.campo select {
  height: 32px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--sheet) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%238a8a8a' stroke-width='1.2'><path d='M3 4.5 6 8 9 4.5'/></svg>") no-repeat right 10px center;
  appearance: none;
  font-size: 13px;
  color: var(--ink);
}
.campo select:hover { border-color: var(--line-strong); }
.mais-filtros {
  height: 32px;
  font-size: 13px;
  color: var(--muted);
  padding: 0 4px;
  align-self: flex-end;
}
.mais-filtros:hover { color: var(--ink); }
.filtros-extra {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
  padding-top: 4px;
}

/* ---------- KPI strip ---------- */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(var(--cols, 6), minmax(0, 1fr));
  margin-top: var(--gap);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.kpi {
  padding: 16px 20px 18px;
  border-right: 1px solid var(--line);
  min-width: 0;
}
.kpi:last-child { border-right: 0; }
.kpi.grupo { border-right-width: 1px; box-shadow: inset -1px 0 0 var(--line-strong); }
.kpi-label {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  line-height: 18px;
  min-height: 36px;
}
.kpi-valor {
  margin-top: 8px;
  font-size: 24px;
  font-weight: 400;
  line-height: 28px;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.kpi-hint {
  margin-top: 4px;
  font-size: 12px;
  line-height: 18px;
  color: var(--faint);
}

/* ---------- overview: path + rail ---------- */
.overview {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: var(--gap);
  margin-top: var(--gap);
  align-items: start;
}
.panel { min-width: 0; }
.panel h2, .bloco h2, .vendas h2 { margin-bottom: 12px; }
.rail {
  padding-left: 24px;
  border-left: 1px solid var(--line);
  min-width: 0;
}

/* conversion path (signature) */
.path {
  position: relative;
  padding: 8px 0 0;
}
.path-svg { width: 100%; height: auto; display: block; overflow: visible; }
.path-label {
  font-size: 11px;
  fill: var(--muted);
  font-family: var(--font);
}
.path-count {
  font-size: 13px;
  fill: var(--ink);
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
}
.path-pct {
  font-size: 11px;
  fill: var(--faint);
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
}

.path-list { display: none; list-style: none; margin: 0; padding: 0; }
.path-list li {
  display: grid;
  grid-template-columns: 10px 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  line-height: 20px;
}
.path-list li:last-child { border-bottom: 0; }
.path-list .dot {
  width: 8px; height: 8px;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  background: var(--sheet);
  justify-self: center;
}
.path-list li.tem .dot { background: var(--accent); }
.path-list .n { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; color: var(--ink); }
.path-list .p { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; color: var(--faint); font-size: 12px; min-width: 36px; text-align: right; }

.chart-empty {
  margin-top: 8px;
  font-size: 13px;
  line-height: 20px;
  color: var(--muted);
  max-width: 48ch;
}
.tip {
  position: absolute;
  z-index: 5;
  min-width: 160px;
  max-width: 240px;
  padding: 8px 10px;
  background: var(--ink);
  color: #f4f4f4;
  font-size: 12px;
  line-height: 18px;
  border-radius: 6px;
  pointer-events: none;
  font-weight: 400;
}
.tip b { display: block; font-weight: 500; color: #fff; margin-bottom: 2px; }

/* vendas */
.venda-resumo {
  font-size: 13px;
  line-height: 20px;
  color: var(--muted);
  margin: 0 0 16px;
}
.venda-resumo strong { color: var(--ink); font-weight: 500; }
.venda-linha { margin: 0 0 14px; }
.venda-linha .topo-linha {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  line-height: 18px;
}
.venda-linha .nome { color: var(--ink); }
.venda-linha .meta { color: var(--faint); font-size: 12px; }
.barra {
  margin-top: 6px;
  height: 4px;
  background: var(--line);
  border-radius: 0;
  overflow: hidden;
}
.barra > span {
  display: block;
  height: 100%;
  background: var(--accent);
}
.venda-nota {
  margin-top: 16px;
  font-size: 12px;
  line-height: 18px;
  color: var(--faint);
}

/* ---------- charts (funil por etapa) ---------- */
.linha-wrap { position: relative; margin-top: 4px; }
.linha-svg { width: 100%; height: auto; display: block; }
.bloco { margin-top: var(--gap); }

/* ---------- tables ---------- */
.tabela {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 20px;
}
.tabela th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
  text-transform: none;
  padding: 0 12px 8px 0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tabela td {
  padding: 10px 12px 10px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--ink);
}
.tabela td:last-child, .tabela th:last-child { padding-right: 0; }
.tabela th.dir, .tabela td.dir, .tabela td.num, .tabela th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tabela tr:hover td { background: transparent; }
.tabela .cap-row td {
  padding-top: 18px;
  padding-bottom: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--faint);
  border-bottom: 0;
}
.queda { color: var(--queda); }
.ok { color: var(--ink); }

.bars { display: flex; align-items: center; gap: 8px; }
.track {
  flex: 1;
  height: 4px;
  background: var(--line);
  min-width: 64px;
  max-width: 160px;
}
.track > span { display: block; height: 100%; background: var(--accent); }

/* A/B */
.ab-bloco { margin-top: var(--gap); }
.ab-bloco:first-child { margin-top: 0; }
.ab-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}
.badge {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
}
.badge.vencedor { color: var(--accent); }
.ab-meta {
  font-size: 13px;
  line-height: 20px;
  color: var(--muted);
  margin: 0 0 16px;
  max-width: 72ch;
}
.ci { display: flex; flex-direction: column; gap: 4px; min-width: 120px; }
.ci .range {
  position: relative;
  height: 4px;
  background: var(--line);
}
.ci .range b {
  position: absolute;
  top: 0; height: 100%;
  background: var(--accent);
  font-weight: 400;
}
.ci .range i {
  position: absolute;
  top: -3px;
  width: 1px;
  height: 10px;
  background: var(--ink);
}
.link {
  display: inline;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
.link:hover { color: var(--ink); }
.sub { font-size: 12px; color: var(--faint); font-weight: 400; }

/* gargalos */
.sugestao {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.sugestao:first-of-type { margin-top: 8px; }
.sugestao strong { display: block; font-weight: 500; font-size: 14px; }
.sugestao p { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 20px; max-width: 68ch; }

/* respostas */
.perg { margin-top: var(--gap); padding-top: var(--gap); border-top: 1px solid var(--line); }
.perg:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.perg h3 { font-weight: 500; }
.perg .n { font-size: 12px; color: var(--faint); margin: 2px 0 12px; }

/* empty + loading */
.empty {
  margin-top: var(--gap);
  padding: 32px 0;
  font-size: 14px;
  line-height: 22px;
  color: var(--muted);
  max-width: 52ch;
}
.empty.curto { padding: 12px 0 0; margin-top: 0; }
.loading {
  margin-top: 32px;
  font-size: 13px;
  color: var(--faint);
}

/* compare / ticket tables sit under a heading */
.seccao { margin-top: var(--gap); }
.seccao h2 { margin-bottom: 12px; }
.lede-seccao {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 20px;
  color: var(--muted);
  max-width: 68ch;
}

/* ---------- phone ---------- */
@media (max-width: 899px) {
  .frame {
    display: block;
    background: var(--sheet);
    min-height: 100vh;
  }
  .topbar { display: none; }
  .sheet {
    margin: 0;
    border: 0;
    border-radius: 0;
    overflow: visible;
  }
  .canvas { padding: 16px 16px 48px; }
  .page-head h1 { display: none; }
  .page-head { margin-bottom: 0; }
  .finding { margin-top: 0; }

  .phone-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 48px;
    padding: 0 12px 0 8px;
    border-bottom: 1px solid var(--line);
    background: var(--sheet);
    position: sticky;
    top: 0;
    z-index: 20;
  }
  .phone-bar h1 {
    flex: 1;
    font-size: 15px;
    line-height: 20px;
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .btn-menu {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink);
  }
  .btn-menu svg { width: 18px; height: 18px; }

  .sidebar {
    position: fixed;
    z-index: 40;
    top: 0; left: 0; bottom: 0;
    width: min(280px, 86vw);
    background: var(--ground);
    border-right: 1px solid var(--line);
    transform: translateX(-105%);
    transition: transform 160ms ease;
    padding-top: 20px;
  }
  .sidebar.aberto { transform: none; }
  .nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(20, 20, 20, 0.28);
    z-index: 30;
    border: 0;
  }

  .kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .kpi { padding: 14px 12px 16px; }
  .kpi:nth-child(2n) { border-right: 0; box-shadow: none; }
  .kpi.grupo { box-shadow: none; }
  .kpi-label { min-height: 36px; }
  .kpi-valor { font-size: 22px; line-height: 26px; }

  .overview {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .rail {
    padding-left: 0;
    border-left: 0;
    padding-top: 4px;
    border-top: 1px solid var(--line);
  }

  .path-svg { display: none; }
  .path-list { display: block; margin-top: 4px; }

  .scope { margin-top: 16px; }
  .tabs { width: 100%; margin-right: 0; overflow-x: auto; }
  .campo { min-width: calc(50% - 8px); flex: 1 1 140px; }

  .tabela { display: block; overflow-x: auto; }
}

@media (max-width: 480px) {
  .kpi-valor { font-size: 20px; line-height: 24px; }
}

@media (min-width: 900px) and (max-width: 1180px) {
  .overview { grid-template-columns: 1fr 300px; }
  .kpi { padding: 16px 14px 18px; }
  .kpi-valor { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}
