:root {
  --bg: #f6f5f2;
  --panel: #ffffff;
  --fg: #1d1c1a;
  --muted: #6b6862;
  --line: #e4e1da;
  --accent: #b8862f;
  --s1: #2f5d8a;
  --s2: #b8862f;
  --ok: #2e7d4f;
  --bad: #b3402a;
  --warn: #9a6a12;
  --grid: #ece9e2;
  --radius: 10px;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141412;
    --panel: #1d1c1a;
    --fg: #ecebe7;
    --muted: #a19e97;
    --line: #34322e;
    --accent: #d4a54f;
    --s1: #7aa7d6;
    --s2: #d4a54f;
    --ok: #6cc28f;
    --bad: #e2765f;
    --warn: #e0b45c;
    --grid: #2a2926;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans); font-size: 15px; line-height: 1.45; }
a { color: inherit; }
.topo { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; }
.marca { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; letter-spacing: .02em; }
.marca i { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); display: inline-block; }
.topo nav { display: flex; gap: 16px; font-size: 14px; color: var(--muted); }
.topo nav a { text-decoration: none; }
.topo nav a:hover { color: var(--fg); }
.pagina { max-width: 1240px; margin: 0 auto; padding: 24px 16px 64px; display: flex; flex-direction: column; gap: 24px; }
h1 { font-family: var(--serif); font-weight: 400; font-size: 30px; margin: 0; }
h2 { font-size: 16px; font-weight: 600; margin: 0; }
.lede { color: var(--muted); margin: 6px 0 0; }
.lede b { color: var(--fg); }
.nota { font-size: 13px; color: var(--muted); margin: 0; }
.aviso { font-size: 13px; color: var(--warn); margin: 0; }
.conteudo { display: flex; flex-direction: column; gap: 24px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.grade { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; }

/* página inicial */
.lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 16px; }
.item { text-decoration: none; transition: border-color .15s, transform .15s; }
.item:hover { border-color: var(--accent); transform: translateY(-1px); }
.item .area { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.item .titulo { font-family: var(--serif); font-size: 21px; }
.item .quando { font-size: 12px; color: var(--muted); margin-top: auto; }
.item.vazio { border-style: dashed; color: var(--muted); justify-content: center; }

/* login */
.entrar { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.entrar form { width: min(100%, 360px); }
.entrar input { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }
.entrar button, .botao { font: inherit; padding: 10px 14px; border: 0; border-radius: 8px; background: var(--fg); color: var(--bg); cursor: pointer; font-weight: 600; }
.erro { color: var(--bad); font-size: 13px; margin: 0; }

/* abas */
.abas { display: flex; gap: 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.aba { font: inherit; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 8px 14px; cursor: pointer; margin-bottom: -1px; }
.aba[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--fg); font-weight: 600; }
[hidden] { display: none !important; }

/* números */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 4px; min-height: 92px; }
.tile .rot { font-size: 12px; color: var(--muted); }
.tile .val { font-family: var(--serif); font-size: 26px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.tile .sub { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tile.venda { border-color: var(--ok); }
.tile.falha { border-color: var(--bad); }
td.esq, th.esq { text-align: left; }
td.quebra { white-space: normal; min-width: 12rem; }
.pilula { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; border: 1px solid currentColor; white-space: nowrap; }
.pilula.ruim { color: var(--bad); }
.pilula.aviso { color: var(--warn); }
.filtro { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: inherit; font-size: 12px; background: none; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; color: var(--muted); cursor: pointer; }
.chip[aria-pressed="true"] { color: var(--fg); border-color: var(--fg); }

/* funil */
.funil { display: flex; flex-direction: column; gap: 10px; }
.etapa { display: grid; grid-template-columns: 9rem 1fr 4rem; gap: 10px; align-items: center; font-size: 14px; }
.trilho { height: 26px; background: var(--grid); border-radius: 6px; position: relative; overflow: hidden; }
.barra { height: 100%; border-radius: 6px; background: var(--s1); }
.trilho span { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.taxa { text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.taxa.pior { color: var(--bad); font-weight: 600; }

/* gráfico */
.legenda { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legenda i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; margin-right: 6px; vertical-align: -1px; }
.grafico { position: relative; min-height: 260px; }
.grafico svg { display: block; width: 100%; }
.grafico text { fill: var(--muted); font-size: 12px; font-family: var(--sans); }
.dica { position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.12); padding: 6px 10px; font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dica .d { color: var(--muted); margin-bottom: 2px; }

/* tabelas */
.caixa { max-height: 30rem; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th { position: sticky; top: 0; background: var(--panel); text-align: right; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { text-align: right; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
tr.futuro td { color: var(--muted); }
tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
td.bom { color: var(--ok); font-weight: 600; }
td.ruim { color: var(--bad); }
.minibarra { display: inline-block; height: 8px; border-radius: 2px; background: var(--s1); margin-right: 6px; vertical-align: 0; }
.defs { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.defs b { color: var(--fg); }
@media (max-width: 560px) { .etapa { grid-template-columns: 7rem 1fr 3rem; } h1 { font-size: 24px; } .topo { padding: 12px 16px; } }
