/* Metas e ranking (#/metas), modo TV (#/metas/tv), placar do topo e cartão do Painel. Cores pelos tokens do tema (claro e escuro);
   ouro, prata e bronze só no pódio e nas posições; vermelho só para perigo. */
.tg .nowrap, .nowrap { white-space: nowrap; }
.tg-row { align-items: start; margin-top: 14px; }

/* comemoração discreta das conquistas novas */
.tg-cel { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 14px; border-radius: var(--r2); border: 1px solid var(--brand-line);
  background: linear-gradient(120deg, var(--brand-bg), color-mix(in srgb, #f59e0b 12%, var(--panel))); position: relative; overflow: hidden; }
.tg-cel::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .45) 50%, transparent 70%); transform: translateX(-100%); animation: tgShine 2.4s ease .3s 2; pointer-events: none; }
.tg-cel-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: #f59e0b; color: #fff; flex: none; animation: tgPop .6s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes tgShine { to { transform: translateX(100%); } }
@keyframes tgPop { from { transform: scale(.4) rotate(-12deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* você + pódio */
.tg-top { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; }
.tg-place { text-align: center; min-width: 64px; }
.tg-n { font-family: var(--display); font-weight: 800; font-size: 44px; line-height: 1; letter-spacing: -.03em; color: var(--brand2); }
.tg-pts { margin-top: 6px; font-size: 13px; color: var(--muted); }
.tg-pts b { font-family: var(--display); font-weight: 800; font-size: 28px; color: var(--text); letter-spacing: -.02em; margin-right: 4px; font-variant-numeric: tabular-nums; }
.tg-lvbar { margin-top: 14px; }
.tg-lv { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 6px; border-radius: 20px; font-size: 11px; font-weight: 700; white-space: nowrap;
  color: var(--lv); background: color-mix(in srgb, var(--lv) 13%, var(--panel)); border: 1px solid color-mix(in srgb, var(--lv) 30%, transparent); }
.tg-lv svg.i { width: 12px; height: 12px; fill: currentColor; }
.tg-bd { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; font-size: 12px; }
.tg-bd span { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px; background: var(--hover); color: var(--text2); }
.tg-bd span b { color: var(--text); font-variant-numeric: tabular-nums; }
.tg-bd svg.i { width: 13px; height: 13px; color: var(--muted); }
.tg-podium { display: flex; align-items: flex-end; justify-content: center; gap: 10px; padding-top: 6px; }
.tg-pod { flex: 1; max-width: 150px; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; }
.tg-pod b { max-width: 100%; font-size: 13px; }
.tg-step { width: 100%; margin-top: 6px; border-radius: 10px 10px 0 0; display: grid; place-items: center; color: #fff; font-family: var(--display); font-weight: 800; font-size: 22px; }
.tg-pod.p1 .tg-step { height: 92px; background: linear-gradient(180deg, #f8b632, #d97706); }
.tg-pod.p2 .tg-step { height: 68px; background: linear-gradient(180deg, #a7b2c4, #6b7a90); }
.tg-pod.p3 .tg-step { height: 50px; background: linear-gradient(180deg, #d0894a, #9a4d12); }
.tg-pod.p1 .av { box-shadow: 0 0 0 3px #f59e0b; }
/* a classe .lg das legendas de gráfico (app.css) deixava o avatar grande quadrado */
.tg .av.lg, .tv .av.lg, .tg-home .av.lg { border-radius: 50%; display: inline-flex; }

/* ranking */
.tg-rank { margin-top: 14px; }
.tg-tbl tr.click { cursor: pointer; }
.tg-tbl tr.tg-me td { background: color-mix(in srgb, var(--brand) 6%, var(--panel)); }
.tg-tbl .tg-bdrow td { padding-top: 0; }
.tg-tbl .tg-bdrow .tg-bd { margin-top: 2px; }
.tg-pos { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11.5px; font-weight: 800; background: var(--hover); color: var(--muted); flex: none; }
.tg-pos.sm { width: 20px; height: 20px; font-size: 10.5px; }
.tg-pos.p1 { background: #f59e0b; color: #fff; } .tg-pos.p2 { background: #94a3b8; color: #fff; } .tg-pos.p3 { background: #b45309; color: #fff; }

/* metas */
.tg-tg + .tg-tg { margin-top: 14px; }
.tg-tgt { font-size: 12px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.tg-tgt:empty { display: none; }
.tg-per { margin: 8px 0 4px; }
.tg-t { padding: 6px 0; }
.tg-t[data-edit] { cursor: pointer; border-radius: 8px; }
.tg-t[data-edit]:hover { background: var(--hover); box-shadow: 0 0 0 6px var(--hover); }
.tg-t .goal { margin-top: 5px; }
.tg-oth { margin-top: 14px; }
.tg-oth summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text2); }

/* desafios */
.tg-chs { margin-top: 14px; }
.tg-chg { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.tg-ch { border: 1px solid var(--line); border-radius: var(--r2); padding: 14px; display: flex; flex-direction: column; gap: 6px; background: var(--panel2); }
.tg-ch.active { border-color: var(--brand-line); background: color-mix(in srgb, var(--brand) 4%, var(--panel)); }
.tg-prize { color: var(--amber); }
.tg-st { display: flex; flex-direction: column; gap: 5px; margin-top: 6px; }
.tg-st .row.tg-me b, .tg-st .row.tg-me .grow { color: var(--brand2); }

/* conquistas */
.tg-bdgc { margin-top: 14px; }
.tg-badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.tg-badge { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); opacity: .62; }
.tg-badge.got { opacity: 1; background: color-mix(in srgb, #f59e0b 8%, var(--panel)); border-color: color-mix(in srgb, #f59e0b 35%, var(--line)); }
.tg-bi { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--hover); color: var(--faint); }
.tg-badge.got .tg-bi { background: #f59e0b; color: #fff; }
.tg-how { margin-top: 14px; line-height: 1.6; }

/* janelas do gestor */
.tg-fld { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text2); }
.tg-gm-all { display: flex; align-items: flex-end; gap: 8px; }
.tg-gm-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 8px; max-height: 44vh; overflow: auto; padding: 2px; }
.tg-gm-p { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 9px; font-size: 13px; }
.tg-gm-p input { width: 120px; }
.tg-fs { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px 14px; margin: 0; min-width: 0; }
.tg-fs legend { font-size: 12px; font-weight: 700; color: var(--text2); padding: 0 6px; }
.tg-lvs { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.tg-out { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 8px; }

/* placar do topo */
.scorebar .tg-sc, .scorebar .tg-day { color: inherit; }
.scorebar .tg-sc:hover b, .scorebar .tg-day:hover b { color: var(--brand2); }
.scorebar .tg-celchip { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; padding: 3px 10px 3px 4px; border-radius: 20px; white-space: nowrap; font-weight: 600; font-size: 11.5px;
  color: #92400e; background: color-mix(in srgb, #f59e0b 18%, var(--panel)); border: 1px solid color-mix(in srgb, #f59e0b 40%, transparent); animation: tgPop .5s cubic-bezier(.2, 1.6, .4, 1) both; }
:root[data-theme="dark"] .scorebar .tg-celchip { color: #fcd34d; }
.scorebar .tg-celchip .ci { width: 20px; height: 20px; border-radius: 50%; background: #f59e0b; color: #fff; display: grid; place-items: center; }
.scorebar .tg-celchip .ci svg.i { width: 12px; height: 12px; }

/* cartão do Painel */
.tg-home { margin-bottom: 14px; }
.tg-home .tg-hgrid { display: grid; grid-template-columns: minmax(180px, .7fr) minmax(0, 2fr); gap: 18px; align-items: start; }
.tg-home .tg-hbars { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 4px 18px; }

/* modo TV: tela cheia, letras grandes, sem o menu e o topo do sistema */
body.tvmode .side, body.tvmode header.top, body.tvmode #scorebar, body.tvmode #banner { display: none !important; }
body.tvmode .app { grid-template-columns: 1fr; }
.tv { min-height: 100%; height: 100%; display: flex; flex-direction: column; background: radial-gradient(1200px 600px at 80% -10%, rgba(59, 99, 255, .35), transparent 60%), var(--side-bg); color: #fff; padding: 2.2vh 3vw; gap: 2.4vh; }
.tv-top { display: flex; align-items: center; gap: 14px; }
.tv-title { font-family: var(--display); font-weight: 800; font-size: clamp(22px, 3.4vw, 54px); letter-spacing: -.03em; }
.tv-title::first-letter, .tv-clock::first-letter { text-transform: uppercase; }
.tv-clock { font-size: clamp(13px, 1.3vw, 22px); color: #c7d0ef; display: inline-block; }
.tv-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .06); color: #fff; display: grid; place-items: center; cursor: pointer; }
.tv-btn:hover { background: rgba(255, 255, 255, .14); }
.tv-body { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: 3vh; animation: tvIn .5s ease both; }
@keyframes tvIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.tv-dots { display: flex; justify-content: center; gap: 8px; }
.tv-dots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, .25); }
.tv-dots i.on { background: #fff; width: 26px; border-radius: 6px; }
.tv-empty { text-align: center; font-size: clamp(18px, 2.2vw, 34px); color: #c7d0ef; }
.tv .av.xl { width: clamp(56px, 7vw, 120px); height: clamp(56px, 7vw, 120px); font-size: clamp(20px, 2.4vw, 40px); }
.tv .av { background: rgba(255, 255, 255, .14) !important; color: #fff; }
.tv .tg-lv { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .2); color: #fff; font-size: clamp(11px, 1vw, 16px); }
.tv-pod { display: flex; align-items: flex-end; justify-content: center; gap: 3vw; }
.tv-p { display: flex; flex-direction: column; align-items: center; gap: .8vh; flex: 0 1 22vw; text-align: center; min-width: 0; }
.tv-pn { font-size: clamp(16px, 2vw, 34px); font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-pp { font-family: var(--display); font-weight: 800; font-size: clamp(22px, 3vw, 52px); font-variant-numeric: tabular-nums; }
.tv-ps { width: 100%; border-radius: 14px 14px 0 0; display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: clamp(22px, 3vw, 52px); margin-top: .6vh; }
.tv-p.p1 .tv-ps { height: 22vh; background: linear-gradient(180deg, #f8b632, #d97706); }
.tv-p.p2 .tv-ps { height: 15vh; background: linear-gradient(180deg, #a7b2c4, #6b7a90); }
.tv-p.p3 .tv-ps { height: 10vh; background: linear-gradient(180deg, #d0894a, #9a4d12); }
.tv-rest, .tv-ch { display: flex; flex-direction: column; gap: 1vh; }
.tv-rest { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 1vh 3vw; }
.tv-r { display: flex; align-items: center; gap: 14px; padding: 1vh 1.2vw; border-radius: 12px; background: rgba(255, 255, 255, .06); font-size: clamp(15px, 1.6vw, 28px); }
.tv-r b { font-variant-numeric: tabular-nums; }
.tv-rpos { font-family: var(--display); font-weight: 800; color: #8ea8ff; min-width: 2.2em; }
.tv-goals { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 3vh 3vw; }
.tv-gl { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; font-size: clamp(15px, 1.7vw, 30px); }
.tv-gl span { min-width: 0; }
.tv-people { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 2vh 2vw; }
.tv-pc { padding: 1.6vh 1.4vw; border-radius: 14px; background: rgba(255, 255, 255, .06); display: flex; flex-direction: column; gap: 1.2vh; }
.tv-pc .tv-gl { font-size: clamp(13px, 1.25vw, 22px); }
.tv-pc .tv-bar { height: clamp(7px, 1vh, 14px); margin-top: .6vh; }
.tv-pch { display: flex; align-items: center; gap: 10px; font-size: clamp(15px, 1.5vw, 26px); }
.tv-pch .tv-pcn { margin-left: auto; color: #c7d0ef; font-size: .75em; white-space: nowrap; }
.tv-gl small { color: #c7d0ef; font-size: .7em; font-weight: 500; }
.tv-gl b { font-family: var(--display); font-weight: 800; white-space: nowrap; }
.tv-bar { height: clamp(10px, 1.6vh, 22px); background: rgba(255, 255, 255, .12); border-radius: 20px; overflow: hidden; margin-top: 1vh; }
.tv-bar div { height: 100%; background: #3b63ff; border-radius: 20px; }
.tv-g.done .tv-bar div { background: #22c55e; }
.tv-total { text-align: center; font-size: clamp(18px, 2.2vw, 38px); color: #c7d0ef; }
.tv-total b { font-family: var(--display); font-weight: 800; color: #fff; font-size: 1.4em; }
.tv-sales { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 1.6vh 2vw; }
.tv-sale { display: flex; align-items: center; gap: 14px; padding: 1.6vh 1.4vw; border-radius: 14px; background: rgba(255, 255, 255, .07); }
.tv-sale > b { font-family: var(--display); font-weight: 800; font-size: clamp(18px, 2vw, 36px); color: #4ade80; white-space: nowrap; }
.tv-st { font-size: clamp(15px, 1.6vw, 28px); font-weight: 700; }
.tv-sw { font-size: clamp(12px, 1.1vw, 19px); color: #c7d0ef; }
.tv-chs { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 2vw; }
.tv-ch { padding: 2vh 1.6vw; border-radius: 16px; background: rgba(255, 255, 255, .06); }
.tv-cht { font-family: var(--display); font-weight: 800; font-size: clamp(20px, 2.4vw, 40px); }
.tv-chs2 { color: #c7d0ef; font-size: clamp(13px, 1.2vw, 20px); margin-bottom: 1vh; }

@media (max-width: 1100px) { .tg-top { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .tg-home .tg-hgrid { grid-template-columns: 1fr; }
  .tv-people { grid-template-columns: 1fr; }
  .tg-n { font-size: 36px; } .tg-pts b { font-size: 24px; }
  .tg-gm-all { flex-wrap: wrap; } .tg-gm-p input { width: 96px; }
  .tv-rest, .tv-goals, .tv-sales, .tv-chs { grid-template-columns: 1fr; }
  .tv-r, .tv-sale { padding: 10px 12px; }
}
@media (prefers-reduced-motion: reduce) { .tg-cel::after, .tg-cel-ic, .scorebar .tg-celchip, .tv-body { animation: none; } }
