:root {
  color-scheme: light;
  /* Superfícies */
  --bg: #f5f5f2;
  --surface: #ffffff;
  --surface-2: #f2f2ee;
  --line: #e6e5e0;
  --line-strong: #d6d4cc;
  /* Texto */
  --text: #101014;
  --text-2: #55565c;
  --muted: #94959c;
  /* Marca Tutory — Manual de Marca 2024/2026 */
  --blue: #334eff;
  --blue-deep: #1f34c9;
  --blue-tint: #e8ebff;
  --orange: #ee5a24;
  --orange-tint: #fdeae1;
  --black: #101014;
  /* Papéis funcionais */
  --accent: var(--blue);
  --track: #ecebe6;
  --good: #1c9b5e;
  --good-tint: #e4f5ec;
  --warn: var(--orange);
  --warn-tint: var(--orange-tint);
  --bad: #d6362e;
  --bad-tint: #fbe7e5;
  /* Escala das barras de progresso, por % da meta batido no período */
  --nivel-0: var(--bad);      /* < 25%  */
  --nivel-1: var(--orange);   /* 25–49% */
  --nivel-2: #e3a400;         /* 50–74% */
  --nivel-3: #7cc242;         /* 75–99% */
  --nivel-4: var(--good);     /* meta batida */
  --closer-1: var(--blue);
  --closer-2: var(--orange);
  --closer-3: #101014;
  --closer-4: #7590a0;
  --display: 'Sora', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(16,16,20,.04), 0 10px 28px -18px rgba(16,16,20,.18);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--sans); }
body { min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
b, strong { font-weight: 700; }

/* ─── Layout ────────────────────────────────────────────────────────────── */
.app { display: flex; flex-direction: column; min-height: 100vh; padding: clamp(10px, 1.1vw, 22px) clamp(14px, 1.6vw, 32px); gap: clamp(8px, 1vw, 16px); }
/* Modo TV: o placar cabe em uma tela, sem rolagem — só em tela alta o bastante (TV 1080p).
   Em janela baixa (notebook) vira página normal com rolagem, em vez de cortar conteúdo.
   Hero e closers dimensionam pelo conteúdo; só a última linha (feeds) absorve a sobra. */
@media (min-height: 860px) {
  body.tv .app { height: 100vh; overflow: hidden; }
  body.tv .view.on[data-v="placar"], body.tv .view.on[data-v="renovacoes"] { display: grid; grid-template-rows: auto auto minmax(0, 1fr); min-height: 0; }
  body.tv .view.on[data-v="placar"] > .grid, body.tv .view.on[data-v="renovacoes"] > .grid { min-height: 0; }
  body.tv .view.on[data-v="placar"] .card, body.tv .view.on[data-v="renovacoes"] .card { overflow: hidden; }
  body.tv .view.on:not([data-v="placar"]):not([data-v="renovacoes"]) { overflow: auto; }
}

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.topkpi { display: flex; align-items: center; gap: clamp(14px, 1.6vw, 28px); padding-right: clamp(12px, 1.2vw, 20px); border-right: 1px solid var(--line-strong); }
.topkpi .kpi { display: flex; flex-direction: column; gap: 1px; }
.topkpi .k { font-size: clamp(9px, .66vw, 11px); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; white-space: nowrap; }
.topkpi .v { font-family: var(--display); font-size: clamp(18px, 1.5vw, 28px); font-weight: 800; letter-spacing: -.02em; line-height: 1.05; white-space: nowrap; color: var(--text); }
.topkpi .v.meta { color: var(--blue); }
.topkpi .v .s { font-family: var(--sans); font-size: .5em; color: var(--text-2); font-weight: 600; margin-left: 4px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo { height: clamp(22px, 2vw, 30px); width: auto; color: var(--black); flex-shrink: 0; }
.brand .div { width: 1px; height: clamp(18px, 1.6vw, 26px); background: var(--line-strong); }
.brand h1 { margin: 0; font-family: var(--display); font-size: clamp(18px, 1.6vw, 28px); font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.brand h1 small { font-weight: 500; color: var(--text-2); font-size: .62em; margin-left: 8px; }
.topmeta { display: flex; align-items: center; gap: 16px; font-size: clamp(11px, .85vw, 14px); color: var(--text-2); font-weight: 500; }
.topmeta .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--good); margin-right: 6px; }
.topmeta .dot.bad { background: var(--bad); }
.topmeta .dot.warn { background: var(--warn); }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); cursor: pointer; font-size: 15px; }
.iconbtn:hover { border-color: var(--line-strong); color: var(--text); }
.iconbtn.on { color: var(--blue); border-color: var(--blue-tint); background: var(--blue-tint); }
.tabs { display: flex; gap: 6px; }
.tabs button { background: transparent; border: 1px solid var(--line); color: var(--text-2); font: 600 clamp(12px, .85vw, 15px) var(--sans); padding: 8px 14px; border-radius: 999px; cursor: pointer; }
.tabs button.on { background: var(--black); color: #fff; border-color: var(--black); }
.tabs button:hover:not(.on) { border-color: var(--line-strong); color: var(--text); }

.grid { display: grid; gap: clamp(8px, 1vw, 16px); }
.grid.hero { grid-template-columns: 5fr 7fr; }
.grid.closers { grid-template-columns: repeat(var(--n, 2), 1fr); }
.grid.bottom { grid-template-columns: 6fr 3fr 3fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.onetwo { grid-template-columns: 1fr 2fr; }
.view { display: none; flex-direction: column; gap: clamp(10px, 1.2vw, 20px); flex: 1; }
.view.on { display: flex; }

/* ─── Cards ─────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(12px, 1.1vw, 20px) clamp(14px, 1.3vw, 24px); display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 0; }
/* Nada dentro do card encolhe pra caber: a barra de progresso (sem conteúdo próprio) chegava
   a 0px de altura quando faltava espaço vertical. Só o gráfico continua flexível. */
.card > * { flex-shrink: 0; }
.card h2 { margin: 0; font-size: clamp(11px, .78vw, 13px); font-family: var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 700; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card h2 .sub { letter-spacing: 0; text-transform: none; font-family: var(--sans); color: var(--text-2); font-weight: 500; font-size: 1.1em; }

/* Divisor de seção dentro de uma aba (junta dois assuntos numa view só, ex.: vendas + em aberto). */
.section-title { margin: 10px 0 0; padding-top: 16px; border-top: 1px solid var(--line); display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: clamp(12px, .88vw, 15px); font-family: var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.section-title .sub { letter-spacing: 0; text-transform: none; color: var(--text-2); font-weight: 500; font-size: 1em; }

.hero-number { font-family: var(--display); font-size: clamp(38px, 4.2vw, 80px); font-weight: 700; letter-spacing: -.03em; line-height: 1; color: var(--text); font-variant-numeric: proportional-nums; }
.hero-number .cur { font-size: .4em; font-weight: 600; color: var(--muted); margin-right: .14em; vertical-align: .58em; letter-spacing: 0; font-family: var(--sans); }
.hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.hero-sub { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 8px clamp(16px, 2.2vw, 40px); }
.kv { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.kv .k { font-size: clamp(10px, .7vw, 12px); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); white-space: nowrap; font-weight: 600; }
.kv .v { font-family: var(--display); font-size: clamp(16px, 1.35vw, 26px); font-weight: 700; letter-spacing: -.015em; white-space: nowrap; color: var(--text); }
.kv .v.big { font-size: clamp(22px, 2vw, 38px); }
.kv .v .s { font-size: .58em; color: var(--muted); font-weight: 600; font-family: var(--sans); }
.kv .v.good { color: var(--good); } .kv .v.warn { color: var(--warn); } .kv .v.bad { color: var(--bad); }
.kv .hint { font-size: clamp(11px, .78vw, 14px); color: var(--text-2); font-weight: 500; }

/* ─── Meter ─────────────────────────────────────────────────────────────── */
.meter { position: relative; height: clamp(10px, 1vw, 16px); background: var(--track); border-radius: 999px; overflow: visible; margin: 6px 0 2px; }
/* A barra é a própria chama: gradiente por faixa + textura tremeluzindo, tudo contido
   dentro da altura da barra (não passa por cima nem sai dela). */
.meter .fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; overflow: hidden; background: var(--blue); transition: width .8s cubic-bezier(.2,.8,.2,1); min-width: 0; }
.meter .fill::before { content: ''; position: absolute; inset: 0; background:
    repeating-linear-gradient(70deg, rgba(255,255,255,.22) 0 3px, transparent 3px 9px),
    repeating-linear-gradient(-70deg, rgba(0,0,0,.14) 0 2px, transparent 2px 10px);
  background-size: 16px 100%, 22px 100%;
  animation: tremeluzir 1.1s linear infinite;
  mix-blend-mode: overlay;
}
@keyframes tremeluzir { 0% { background-position: 0 0, 0 0; } 100% { background-position: -16px 0, 22px 0; } }
.meter .fill.n0, .stat .mini i.n0 { background: var(--nivel-0); }
.meter .fill.n1, .stat .mini i.n1 { background: var(--nivel-1); }
.meter .fill.n2, .stat .mini i.n2 { background: var(--nivel-2); }
.meter .fill.n3, .stat .mini i.n3 { background: var(--nivel-3); }
.meter .fill.n4, .stat .mini i.n4 { background: var(--nivel-4); }
.meter .mark { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--black); border-radius: 2px; transform: translateX(-50%); box-shadow: 0 0 0 2px var(--surface); }
.meter .mark::after { content: attr(data-label); position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 6px; font: 600 clamp(10px, .68vw, 12px) var(--sans); color: var(--muted); white-space: nowrap; letter-spacing: .02em; }
.meter-legend { display: flex; justify-content: space-between; font-size: clamp(10px, .75vw, 13px); color: var(--text-2); margin-top: 16px; font-weight: 500; }
.meter-legend b { color: var(--text); font-weight: 700; }

/* ─── Status pill ───────────────────────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font: 700 clamp(11px, .76vw, 13px) var(--sans); white-space: nowrap; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.good { color: var(--good); background: var(--good-tint); }
.pill.warn { color: #b6480f; background: var(--warn-tint); }
.pill.bad { color: var(--bad); background: var(--bad-tint); }

/* ─── Avatar ────────────────────────────────────────────────────────────── */
.avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--surface-2); border: 2px solid var(--surface); box-shadow: 0 0 0 2px var(--ring, var(--line-strong)); }
.avatar.fallback { display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; color: #fff; background: var(--ring, var(--muted)); }

/* ─── Closer card ───────────────────────────────────────────────────────── */
.closer { border-top: 4px solid var(--c, var(--blue)); }
.closer .head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.closer .who { display: flex; align-items: center; gap: 10px; }
.closer .avatar { width: clamp(30px, 2.6vw, 44px); height: clamp(30px, 2.6vw, 44px); font-size: clamp(12px, 1.1vw, 17px); }
.closer .name { font-family: var(--display); font-size: clamp(19px, 1.7vw, 28px); font-weight: 700; letter-spacing: -.015em; }
.closer .numbers { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.closer.off { opacity: .55; border-top-style: dashed; background: var(--track); }
.closer.off .name .obs { font: 600 clamp(11px, .8vw, 14px) var(--sans); color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.closer.off .pill { color: var(--muted); background: var(--surface); border: 1px solid var(--line); }
.closer.off .pill::before { display: none; }
.closer .feito { font-family: var(--display); font-size: clamp(28px, 2.7vw, 52px); font-weight: 700; letter-spacing: -.025em; line-height: 1; }
.closer .feito .cur { font-size: .42em; color: var(--muted); font-weight: 600; vertical-align: .52em; margin-right: .12em; font-family: var(--sans); }
.closer .de { font-size: clamp(12px, .92vw, 16px); color: var(--text-2); font-weight: 500; }
.closer .de b { color: var(--text); font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 4px; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat .k { font-size: clamp(9px, .66vw, 11px); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.stat .v { font-family: var(--display); font-size: clamp(15px, 1.25vw, 22px); font-weight: 700; letter-spacing: -.015em; white-space: nowrap; }
.stat .v .s { font-size: .6em; color: var(--muted); font-weight: 600; font-family: var(--sans); }
.stat .v.good { color: var(--good); } .stat .v.warn { color: #b6480f; } .stat .v.bad { color: var(--bad); }
.stat .hint { font-size: clamp(10px, .72vw, 13px); color: var(--text-2); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .mini { height: 5px; background: var(--track); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.stat .mini i { display: block; height: 100%; background: var(--blue); border-radius: 99px; }

/* ─── Chart ─────────────────────────────────────────────────────────────── */
.chart { position: relative; flex: 1 1 0; min-height: 140px; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .axis text { fill: var(--muted); font: 600 11px var(--sans); }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .ideal { fill: none; stroke: var(--text-2); stroke-width: 1.75; stroke-dasharray: 5 5; opacity: .55; }
.chart .real { fill: none; stroke: var(--blue); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--blue); opacity: .08; }
.chart .meta-line { stroke: var(--good); stroke-width: 1.5; stroke-dasharray: 2 4; opacity: .85; }
.chart .today { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .pt { fill: var(--blue); stroke: var(--surface); stroke-width: 2; }
.chart .lbl { fill: var(--text-2); font: 700 11px var(--sans); }
.chart .lbl.good { fill: var(--good); }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .crosshair { stroke: var(--text-2); stroke-width: 1; opacity: 0; pointer-events: none; }
.tooltip { position: absolute; pointer-events: none; background: var(--black); border: 1px solid var(--black); border-radius: 10px; padding: 8px 10px; font: 600 12px var(--sans); color: #fff; white-space: nowrap; opacity: 0; transition: opacity .12s; z-index: 5; transform: translate(-50%, -110%); box-shadow: var(--shadow); }
.tooltip b { color: #fff; }
.legend { display: flex; gap: 16px; font: 600 clamp(10px, .75vw, 13px) var(--sans); color: var(--text-2); flex-wrap: wrap; }
.legend span::before { content: ''; display: inline-block; width: 14px; height: 3px; vertical-align: middle; margin-right: 6px; border-radius: 2px; background: var(--blue); }
.legend .i::before { background: var(--text-2); }
.legend .m::before { background: var(--good); }

/* ─── Lists / tables ────────────────────────────────────────────────────── */
.feed { display: flex; flex-direction: column; gap: 0; overflow: hidden; }
.feed .row { display: grid; grid-template-columns: 60px 1fr auto auto; gap: 12px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: clamp(12px, .95vw, 17px); }
.feed .row:last-child { border-bottom: 0; }
.feed .when { color: var(--muted); font-size: .82em; font-weight: 600; }
.feed .who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed .who small { color: var(--muted); font-weight: 500; margin-left: 6px; }
.feed .tag { font-size: .76em; font-weight: 700; color: var(--text-2); background: var(--surface-2); padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.feed .tag.c1 { color: var(--blue); background: var(--blue-tint); } .feed .tag.c2 { color: #b6480f; background: var(--orange-tint); } .feed .tag.c3 { color: var(--text); background: var(--surface-2); } .feed .tag.c4 { color: var(--closer-4); }
.feed .val { font-family: var(--display); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { color: var(--muted); font-size: clamp(12px, .95vw, 16px); padding: 12px 0; }

table.t { width: 100%; border-collapse: collapse; font-size: clamp(12px, .95vw, 16px); }
table.t th { text-align: left; font: 700 clamp(10px, .7vw, 12px) var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line-strong); }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t tr.atual td { background: var(--blue-tint); }
table.t tr.atual td:first-child { box-shadow: inset 3px 0 0 var(--blue); }
table.t .muted { color: var(--muted); }
table.t b { font-weight: 700; }

.rows { display: flex; flex-direction: column; gap: 6px; }
.rows .r { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: clamp(12px, .9vw, 16px); padding: 4px 0; border-bottom: 1px solid var(--line); }
.rows .r:last-child { border-bottom: 0; }
.rows .r .l { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.rows .r .l small { color: var(--muted); }
.rows .r .v { font-family: var(--display); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

.note { font-size: clamp(11px, .8vw, 14px); color: var(--text-2); line-height: 1.45; }
.note b { color: var(--text); }
/* Chip com o rótulo da faixa (ex.: "7%") ao lado de cada barra */
.faixa { display: inline-block; font: 700 clamp(10px, .7vw, 12px) var(--sans); line-height: 1.5; padding: 1px 8px; border-radius: 999px; color: #fff; margin-left: 8px; vertical-align: 1px; letter-spacing: 0; }
.faixa.n0 { background: var(--nivel-0); } .faixa.n1 { background: var(--nivel-1); } .faixa.n2 { background: var(--nivel-2); } .faixa.n3 { background: var(--nivel-3); } .faixa.n4 { background: var(--nivel-4); }
.stat .k .faixa { float: right; margin-left: 0; font-size: clamp(9px, .62vw, 11px); padding: 0 6px; }
.escala { display: inline-flex; gap: 10px; margin-left: 14px; text-transform: none; letter-spacing: 0; }
.escala i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; vertical-align: -1px; margin-right: 4px; }
.escala i.n0 { background: var(--nivel-0); } .escala i.n1 { background: var(--nivel-1); } .escala i.n2 { background: var(--nivel-2); } .escala i.n3 { background: var(--nivel-3); } .escala i.n4 { background: var(--nivel-4); }
.footer { display: flex; justify-content: space-between; font: 600 clamp(10px, .7vw, 12px) var(--sans); color: var(--muted); letter-spacing: .04em; padding-top: 4px; border-top: 1px solid var(--line); }

/* ─── Erro / loading ────────────────────────────────────────────────────── */
.banner { display: none; background: var(--bad-tint); border: 1px solid #f3c3bf; color: var(--text); padding: 10px 14px; border-radius: 12px; font-size: clamp(12px, .9vw, 15px); font-weight: 500; }
.banner.on { display: block; }
.loading { color: var(--muted); padding: 40px; text-align: center; font-weight: 500; }

/* ─── Celebração de venda nova ──────────────────────────────────────────── */
#celebra { position: fixed; inset: 0; pointer-events: none; z-index: 61; overflow: hidden; }
.confete { position: absolute; top: -24px; will-change: transform, opacity; animation: cair linear forwards; }
.confete.circ { border-radius: 50%; }
.confete.fita { border-radius: 999px; }
@keyframes cair {
  0%   { transform: translate3d(0,0,0) rotate(0deg); opacity: 1; }
  100% { transform: translate3d(var(--dx), 108vh, 0) rotate(var(--rot)); opacity: .85; }
}
.buzina { position: fixed; width: clamp(120px, 13vw, 230px); height: auto; pointer-events: none; opacity: 0; filter: drop-shadow(0 10px 22px rgba(16,16,20,.4)); animation: buzinaPular 1.6s cubic-bezier(.34,1.56,.64,1) forwards; }
@keyframes buzinaPular {
  0%   { opacity: 0; transform: translateY(50px) scale(.3) rotate(var(--rot0)); }
  32%  { opacity: 1; transform: translateY(-14px) scale(1.2) rotate(var(--rot1)); }
  50%  { transform: translateY(0) scale(1) rotate(var(--rot2)); }
  66%  { transform: translateY(-8px) scale(1.08) rotate(var(--rot1)); }
  82%  { transform: translateY(0) scale(1) rotate(0deg); }
  100% { opacity: 0; transform: translateY(-16px) scale(.85) rotate(0deg); }
}
.confete.burst { top: 42vh; left: 50vw; border-radius: 3px; animation: estourar cubic-bezier(.15,.8,.3,1) forwards; }
.confete.burst.circ { border-radius: 50%; }
@keyframes estourar {
  0%   { transform: translate3d(0,0,0) scale(.4) rotate(0deg); opacity: 1; }
  55%  { transform: translate3d(var(--bx), var(--by), 0) scale(1) rotate(var(--rot)); opacity: 1; }
  100% { transform: translate3d(var(--bx2), var(--by2), 0) scale(.9) rotate(var(--rot2)); opacity: 0; }
}

#celebraFundo { position: fixed; inset: 0; z-index: 60; background: radial-gradient(circle at 50% 42%, rgba(16,16,20,.32), rgba(16,16,20,.58)); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity .35s ease; }
#celebraFundo.on { opacity: 1; }

#celebraCard { position: fixed; top: 42%; left: 50%; z-index: 62; transform: translate(-50%, -50%) scale(.82); opacity: 0; pointer-events: none; transition: opacity .4s cubic-bezier(.2,.8,.2,1), transform .5s cubic-bezier(.22,1.4,.36,1); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; background: var(--surface); border-radius: 28px; padding: clamp(24px,3vw,40px) clamp(28px,4vw,56px); box-shadow: 0 40px 90px -24px rgba(16,16,20,.45), 0 2px 0 rgba(255,255,255,.6) inset; min-width: clamp(280px, 30vw, 440px); }
#celebraCard.on { opacity: 1; transform: translate(-50%, -50%) scale(1); animation: sombraCard 1.3s ease-in-out infinite; }
@keyframes sombraCard {
  0%, 100% { box-shadow: 0 40px 90px -24px rgba(16,16,20,.45), 0 2px 0 rgba(255,255,255,.6) inset, 0 0 0 0 var(--ring, var(--blue)); }
  50%      { box-shadow: 0 40px 90px -24px rgba(16,16,20,.45), 0 2px 0 rgba(255,255,255,.6) inset, 0 0 55px 16px var(--ring, var(--blue)); }
}
#celebraCard .cc-eyebrow { font-size: clamp(11px,.9vw,14px); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--blue); display: flex; align-items: center; gap: 6px; }
#celebraCard .cc-ring { position: relative; width: clamp(84px,7vw,116px); height: clamp(84px,7vw,116px); border-radius: 50%; animation: pulsar 1s ease-in-out infinite; }
#celebraCard .cc-ring::before { content: ''; position: absolute; inset: -10px; border-radius: 50%; background: conic-gradient(from 0deg, var(--ring, var(--blue)), transparent 65%, var(--ring, var(--blue))); animation: girar 2.2s linear infinite; opacity: .5; }
#celebraCard .cc-ring img, #celebraCard .cc-ring .avatar { position: relative; width: 100% !important; height: 100% !important; border: 4px solid var(--surface); box-shadow: 0 0 0 2px var(--ring, var(--blue)); font-size: clamp(24px,2vw,32px); animation: piscar 1s ease-in-out infinite; }
@keyframes pulsar { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
@keyframes piscar { 0%, 100% { opacity: 1; box-shadow: 0 0 0 2px var(--ring, var(--blue)); } 50% { opacity: .55; box-shadow: 0 0 0 8px var(--ring, var(--blue)); } }
#celebraCard .cc-nome { font-family: var(--display); font-size: clamp(20px,1.8vw,28px); font-weight: 700; letter-spacing: -.01em; color: var(--text); }
#celebraCard .cc-cliente { font-size: clamp(13px,1vw,16px); color: var(--text-2); font-weight: 500; max-width: 36ch; }
#celebraCard .cc-valor { font-family: var(--display); font-size: clamp(38px,4vw,64px); font-weight: 800; letter-spacing: -.02em; color: var(--good); margin-top: 2px; }
#celebraCard .cc-valor .cur { font-size: .5em; font-weight: 700; color: var(--muted); margin-right: .1em; vertical-align: .5em; font-family: var(--sans); }
@keyframes girar { to { transform: rotate(360deg); } }

/* ─── Responsivo ────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .grid.hero, .grid.bottom, .grid.three, .grid.two, .grid.onetwo { grid-template-columns: 1fr; }
  .grid.closers { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  body.tv .app { height: auto; overflow: visible; }
  body.tv .view.on[data-v="placar"], body.tv .view.on[data-v="renovacoes"] { display: flex; }
}
@media (max-width: 640px) {
  .app { padding: 12px 16px; }
  .feed .row { grid-template-columns: 50px 1fr auto; }
  .feed .row .tag { display: none; }
  .hero-number { font-size: 38px; }
  .hero-sub { grid-template-columns: repeat(2, auto); }
  .topmeta { gap: 10px; flex-wrap: wrap; }
}

/* ─── Painel HUB (/hub) ─────────────────────────────────────────────────── */
body.hub .app { min-height: 100vh; }
.mesnav { display: inline-flex; gap: 4px; margin-left: 8px; }
.mesnav a { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line); color: var(--text-2); text-decoration: none; font-weight: 700; font-size: 16px; line-height: 1; }
.mesnav a:hover { border-color: var(--line-strong); color: var(--text); }
.tabs .tablink { display: inline-flex; align-items: center; border: 1px solid var(--line); color: var(--text-2); font: 600 clamp(12px, .85vw, 15px) var(--sans); padding: 8px 14px; border-radius: 999px; text-decoration: none; }
.tabs .tablink:hover { border-color: var(--line-strong); color: var(--text); }
.grid.kpis { grid-template-columns: repeat(4, 1fr); }
.grid.hubrow { grid-template-columns: 6fr 3fr 3fr; align-items: start; }
.grid.hubrow .col { display: flex; flex-direction: column; gap: clamp(8px, 1vw, 16px); min-width: 0; }
.tile { gap: 4px; }
.tile .k { font-size: clamp(10px, .7vw, 12px); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.tile .v { font-family: var(--display); font-size: clamp(22px, 2vw, 38px); font-weight: 700; letter-spacing: -.02em; line-height: 1.05; color: var(--text); white-space: nowrap; }
.tile .d { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: clamp(11px, .78vw, 14px); color: var(--text-2); font-weight: 500; }
.tile.ritmo .v { color: var(--blue); }
.delta { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font: 700 clamp(11px, .76vw, 13px) var(--sans); white-space: nowrap; }
.delta.good { color: var(--good); background: var(--good-tint); }
.delta.bad { color: var(--bad); background: var(--bad-tint); }
.delta.na { color: var(--muted); background: var(--surface-2); }
/* barras mensais: marca fina, topo arredondado, mês parcial tracejado */
.chart g.bar rect:not(.hit) { fill: var(--c, var(--blue)); }
.chart g.bar.parcial rect:not(.hit) { fill-opacity: .45; stroke: var(--c, var(--blue)); stroke-width: 1.5; stroke-dasharray: 4 3; }
.chart g.bar:hover rect:not(.hit) { fill-opacity: .8; }
.chart g.bar .hit { fill: transparent; }
/* parte-do-todo: uma barra empilhada com espaço de 2px entre fatias e rótulo direto na legenda */
.stack { display: flex; gap: 2px; height: 14px; border-radius: 999px; overflow: hidden; background: var(--track); }
.stack i { display: block; min-width: 2px; }
.stack-legend { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; font-size: clamp(11px, .82vw, 14px); color: var(--text-2); font-weight: 500; }
.stack-legend span { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.stack-legend span > i { width: 10px; height: 10px; border-radius: 3px; align-self: center; flex-shrink: 0; }
.stack-legend b { color: var(--text); }
.stack-legend small { color: var(--muted); }
.s1 { background: var(--blue); } .s2 { background: var(--orange); } .s3 { background: #7590a0; }
.share { height: 3px; background: var(--track); border-radius: 99px; margin-top: 4px; max-width: 220px; }
.share i { display: block; height: 100%; background: var(--blue); border-radius: 99px; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 44px; margin-top: 8px; }
.spark i { flex: 1; background: var(--blue); border-radius: 3px 3px 0 0; opacity: .35; min-width: 4px; }
.spark i:last-child { opacity: 1; }
@media (max-width: 1100px) {
  .grid.kpis { grid-template-columns: repeat(2, 1fr); }
  .grid.hubrow { grid-template-columns: 1fr; }
}
