/* ============================================================
   Menu lateral principal, Desempenho (gráficos e calendário)
   e Troféus. Carregado depois de tema.css.
   ============================================================ */
:root { --ok-cal: #2fbf68; --ko-cal: #dc2626; }

/* Menu lateral: somente os menus */
.sb-menu { display: flex; flex-direction: column; gap: 8px; padding-top: 6px; }
.sb-nav { position: relative; display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 13px; color: var(--text); border: 1px solid rgba(255,255,255,.07); background: linear-gradient(180deg, #1a1a22, #13131a); box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 4px 12px rgba(0,0,0,.4); transition: transform .15s, box-shadow .2s, border-color .2s, background .2s; }
.sb-nav:hover { transform: translateX(2px); border-color: rgba(255,255,255,.18); background: linear-gradient(180deg, #22222c, #17171f); box-shadow: 0 8px 20px rgba(0,0,0,.5); }
.sb-nav.active { border-color: rgba(200,62,250,.6); background: linear-gradient(90deg, rgba(200,62,250,.28), rgba(124,92,255,.12) 60%, #16161d); box-shadow: inset 3px 0 0 var(--mg), 0 0 0 1px rgba(200,62,250,.2), 0 10px 26px rgba(200,62,250,.3); }
.sb-ic { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: var(--gray-hi); background: linear-gradient(180deg, #2a2a35, #1c1c24); border: 1px solid rgba(255,255,255,.1); box-shadow: 0 3px 0 rgba(0,0,0,.6); transition: color .2s, background .2s, box-shadow .2s; }
.sb-ic svg { width: 20px; height: 20px; }
.sb-nav.active .sb-ic, .sb-nav:hover .sb-ic { color: #fff; background: linear-gradient(135deg, var(--mg), var(--vio)); border-color: transparent; box-shadow: 0 3px 0 var(--mg-3), 0 6px 16px rgba(200,62,250,.45); }
.sb-lbl { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sb-lbl b { font-size: .93rem; }
.sb-lbl small { font-size: .72rem; color: var(--gray-hi); opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-badge { flex: none; font-size: .68rem; font-weight: 900; color: var(--mg-hi); border: 1px solid rgba(200,62,250,.45); background: rgba(200,62,250,.1); border-radius: 999px; padding: 2px 8px; }
.sb-resumo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 16px; padding: 10px 6px; border-radius: 13px; border: 1px solid transparent; background: linear-gradient(180deg, #111118, #0c0c11) padding-box, var(--grad-edge) border-box; }
.sb-resumo div { text-align: center; }
.sb-resumo b { display: block; font-size: 1.05rem; font-weight: 900; background: linear-gradient(180deg, #fff, var(--mg-hi)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sb-resumo span { font-size: .62rem; text-transform: uppercase; letter-spacing: .5px; color: var(--gray-hi); opacity: .7; font-weight: 800; }

/* Gráficos */
.graf-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; margin-top: 4px; align-items: start; }
.chart-panel .panel-b { padding: 12px 16px 14px; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .gx { stroke: rgba(200,62,250,.14); stroke-width: 1; }
.chart .gt { fill: #a9a3ba; font-size: 12px; font-family: inherit; }
.chart .br-ok { fill: var(--ok-cal); }
.chart .br-ko { fill: var(--ko-cal); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit.hover { fill: rgba(231,166,255,.06); }
.chart-nota { display: block; margin-top: 6px; color: var(--muted); font-size: .74rem; }
.leg { display: inline-flex; align-items: center; gap: 6px; font-size: .76rem; color: var(--gray-hi); margin-left: 12px; }
.lg { display: inline-block; width: 11px; height: 11px; border-radius: 3px; box-shadow: 0 0 6px currentColor; }
.lg.ok { background: linear-gradient(180deg, #9CF7C4, #33C77C); color: rgba(51,199,124,.55); }
.lg.perdido { background: linear-gradient(180deg, #FFC2C2, #EB5C5C); color: rgba(235,92,92,.55); }
.lg.hoje { background: transparent; box-shadow: inset 0 0 0 2px var(--mg-hi); }
.hbars { display: flex; flex-direction: column; gap: 12px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 36%) 1fr auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center; color: var(--text); padding: 4px 6px; border-radius: 8px; }
.hbar.hover, .hbar:hover { background: rgba(255,255,255,.04); }
.hb-nome { font-size: .82rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-trilho { height: 10px; border-radius: 999px; background: rgba(255,255,255,.07); overflow: hidden; }
.hb-trilho i { display: block; height: 100%; border-radius: 999px; background: var(--mg); }
.hb-val { font-weight: 900; font-size: .85rem; min-width: 40px; text-align: right; }
.hb-n { grid-column: 2 / 4; color: var(--muted); font-size: .7rem; }
.chart-tip { position: fixed; z-index: 150; pointer-events: none; max-width: 260px; padding: 7px 10px; border-radius: 9px; font-size: .78rem; color: var(--text); background: #1d1d27; border: 1px solid rgba(200,62,250,.45); box-shadow: 0 10px 24px rgba(0,0,0,.6); }

/* Calendário de estudos */
.cal-panel .panel-h .r { align-items: center; }
.cal-mes { min-width: 130px; text-align: center; font-weight: 800; font-size: .88rem; }
.cal-sem, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-sem { margin: 4px 0 6px; }
.cal-sem span { text-align: center; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--gray-hi); opacity: .7; }
.cal-d { position: relative; height: 58px; border-radius: 10px; display: flex; align-items: flex-start; justify-content: flex-start; padding: 5px 7px; font-size: .78rem; background: #15151c; border: 1px solid rgba(255,255,255,.06); color: #8b8b9c; }
.cal-d.vazio { background: transparent; border: 0; }
.cal-d b { font-weight: 800; }
.cal-d.ok { color: #04130a; background: linear-gradient(160deg, #48d982, var(--ok-cal)); border-color: rgba(255,255,255,.25); box-shadow: 0 4px 14px rgba(47,191,104,.3); }
.cal-d.perdido { color: #fff; background: linear-gradient(160deg, #ef4b4b, var(--ko-cal)); border-color: rgba(255,255,255,.18); box-shadow: 0 4px 14px rgba(220,38,38,.25); }
.cal-d.antes { opacity: .45; }
.cal-d.futuro { color: #6d6d7c; }
.cal-d.is-hoje { box-shadow: 0 0 0 2px var(--mg-hi), 0 0 18px rgba(200,62,250,.45); }
.cal-mk { position: absolute; right: 7px; bottom: 5px; font-style: normal; font-weight: 900; font-size: .85rem; }
.cal-mk.x { width: 10px; height: 10px; }
.cal-mk.x::before, .cal-mk.x::after { content: ""; position: absolute; left: 4px; top: -1px; width: 2px; height: 12px; background: #fff; border-radius: 2px; transform: rotate(45deg); }
.cal-mk.x::after { transform: rotate(-45deg); }
.cal-d.hover { outline: 1px solid rgba(255,255,255,.5); }
.cal-leg { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin-top: 14px; font-size: .78rem; color: var(--gray-hi); }
.cal-leg span { display: inline-flex; align-items: center; gap: 6px; }
.cal-seq { margin-left: auto; }
.cal-seq b { color: var(--mg-hi); }

/* Troféus */
.tf-resumo .panel-b { display: flex; align-items: center; gap: 22px; padding: 16px 20px; flex-wrap: wrap; }
.tf-big { display: flex; align-items: center; gap: 12px; }
.tf-big .tf-svg { width: 56px; height: 56px; filter: drop-shadow(0 4px 14px rgba(255,210,90,.4)); }
.tf-big b { display: block; font-size: 1.4rem; font-weight: 900; }
.tf-big span { color: var(--gray-hi); font-size: .8rem; }
.tf-resumo .bar.big { flex: 1; min-width: 200px; }
.tf-grid { display: block; }
.tf-cat-titulo { margin: 28px 0 12px; font-size: 1.05rem; color: var(--mg-hi); }
.tf-cat-titulo:first-child { margin-top: 4px; }
.tf-cat-titulo.nivel-bronze { color: #F6C08D; } .tf-cat-titulo.nivel-prata { color: #E6EAF2; } .tf-cat-titulo.nivel-ouro { color: #FFE68A; } .tf-cat-titulo.nivel-diamante { color: #BDF4FF; } .tf-cat-titulo.nivel-lenda { color: #F3C1FF; }
.tf-grid-cat { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tf-item { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 14px; border: 1px solid rgba(255,255,255,.07); background: linear-gradient(180deg, #17171f, #111117); transition: transform .2s, box-shadow .2s; }
.tf-item:hover { transform: translateY(-2px); }
.tf-item.ganho { border: 1px solid transparent; background: linear-gradient(180deg, #221a2e, #15151c) padding-box, var(--grad-edge) border-box; box-shadow: var(--lift); }
.tf-item.ganho:hover { box-shadow: var(--lift), var(--glow-soft); }
.tf-ic { flex: none; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px; background: #0d0d12; border: 1px solid rgba(255,255,255,.08); }
.tf-item.ganho .tf-ic { background: radial-gradient(circle at 50% 35%, rgba(255,255,255,.14), #120f18 70%); }
.tf-svg { width: 38px; height: 38px; }
.tf-item.ganho .tf-svg { filter: drop-shadow(0 3px 8px rgba(255,210,90,.35)); }
.tf-item.bloq .tf-svg { opacity: .8; }
.tf-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.tf-txt b { font-size: .92rem; padding-right: 62px; }
.tf-txt span { font-size: .78rem; color: var(--gray-hi); opacity: .8; }
.tf-txt small { font-size: .7rem; color: var(--muted); }
.tf-txt .bar { height: 6px; margin-top: 6px; }
.tf-item.bloq .tf-txt b { color: #b9b9c6; }
.tf-data { color: var(--mg-hi) !important; font-weight: 700; }
.tf-tag { position: absolute; top: 12px; right: 12px; font-size: .6rem; font-weight: 900; letter-spacing: .6px; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; color: #d6d6e0; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); }
.tf-item.nivel-bronze .tf-tag { color: #F6C08D; border-color: rgba(246,192,141,.4); }
.tf-item.nivel-prata .tf-tag { color: #E6EAF2; border-color: rgba(230,234,242,.4); }
.tf-item.nivel-ouro .tf-tag { color: #FFE68A; border-color: rgba(255,230,138,.45); }
.tf-item.nivel-diamante .tf-tag { color: #BDF4FF; border-color: rgba(189,244,255,.45); }
.tf-item.nivel-lenda .tf-tag { color: #F3C1FF; border-color: rgba(243,193,255,.5); }

/* Janela "Parabéns! Mais um troféu conquistado" */
.tf-pop { position: fixed; inset: 0; z-index: 180; display: grid; place-items: center; padding: 18px; background: radial-gradient(60% 60% at 50% 45%, rgba(40,18,60,.82), rgba(4,4,8,.9)); backdrop-filter: blur(4px); animation: tfIn .3s ease-out both; }
.tf-pop.sai { animation: tfOut .28s ease-in both; }
.tf-card { position: relative; width: min(420px, 100%); text-align: center; padding: 30px 24px 22px; border-radius: 22px; overflow: hidden; border: 1px solid transparent; background: linear-gradient(180deg, #24173a, #121218) padding-box, var(--grad-edge) border-box; box-shadow: 0 30px 70px rgba(0,0,0,.7), 0 0 60px rgba(200,62,250,.35); animation: tfPop .55s cubic-bezier(.2,1.5,.4,1) both; }
.tf-raios { position: absolute; left: 50%; top: 92px; width: 520px; height: 520px; margin: -260px 0 0 -260px; background: repeating-conic-gradient(from 0deg, rgba(255,230,138,.16) 0deg 10deg, transparent 10deg 24deg); border-radius: 50%; animation: spin 14s linear infinite; pointer-events: none; -webkit-mask: radial-gradient(circle, #000 25%, transparent 62%); mask: radial-gradient(circle, #000 25%, transparent 62%); }
.tf-medalha { position: relative; width: 120px; height: 120px; margin: 0 auto 10px; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 50% 40%, rgba(255,255,255,.18), rgba(18,14,26,.9) 68%); box-shadow: 0 0 0 3px rgba(255,255,255,.12), 0 0 40px rgba(255,210,90,.35); animation: tfBounce 1.6s ease-in-out .5s infinite; }
.tf-medalha .tf-svg { width: 78px; height: 78px; filter: drop-shadow(0 6px 16px rgba(255,210,90,.5)); }
.tf-parabens { position: relative; font-size: 1.9rem; font-weight: 900; background: linear-gradient(90deg, #FFE68A, #fff, var(--mg-hi)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tf-sub { position: relative; color: var(--gray-hi); font-weight: 700; margin-bottom: 12px; }
.tf-nome { position: relative; font-size: 1.25rem; font-weight: 900; color: #fff; }
.tf-desc { position: relative; color: var(--gray-hi); font-size: .88rem; margin: 4px 0 10px; }
.tf-nivel { position: relative; display: inline-block; font-size: .7rem; font-weight: 900; letter-spacing: .8px; text-transform: uppercase; padding: 3px 12px; border-radius: 999px; color: #fff; background: linear-gradient(135deg, var(--mg), var(--vio)); }
.tf-acts { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.tf-acts .btn { justify-content: center; width: 100%; }
.tf-conf { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.tf-conf i { position: absolute; top: -20px; left: var(--x); width: 8px; height: 14px; border-radius: 2px; background: var(--c); transform: rotate(var(--r)); animation: tfCai 2.6s cubic-bezier(.3,.6,.5,1) var(--d) both; }
@keyframes tfIn { from { opacity: 0; } }
@keyframes tfOut { to { opacity: 0; } }
@keyframes tfPop { from { transform: scale(.6) translateY(30px); opacity: 0; } }
@keyframes tfBounce { 50% { transform: translateY(-6px) scale(1.03); } }
@keyframes tfCai { to { top: 105%; transform: rotate(calc(var(--r) + 540deg)); } }
@media (prefers-reduced-motion: reduce) { .tf-raios, .tf-medalha, .tf-conf i, .tf-card { animation: none; } }

@media (max-width: 1000px) { .graf-grid { grid-template-columns: 1fr; } }
@media (max-width: 600px) {
  .cal-sem, .cal-grid { gap: 4px; }
  .cal-d { height: auto; aspect-ratio: 1; padding: 3px 4px; font-size: .68rem; border-radius: 8px; }
  .cal-mk { right: 3px; bottom: 2px; font-size: .7rem; }
  .cal-mk.x { transform: scale(.8); }
  .cal-seq { margin-left: 0; }
  .cal-mes { min-width: 0; }
  .tf-grid-cat { grid-template-columns: 1fr; }
  .hbar { grid-template-columns: minmax(80px, 38%) 1fr auto; }
}

/* Filtros de periodo e de categoria (uma linha acima dos graficos) */
.filtros { display: flex; flex-wrap: wrap; gap: 6px; padding: 5px; margin: 0 0 16px; border-radius: 13px; width: fit-content; max-width: 100%; border: 1px solid transparent; background: linear-gradient(180deg, #111118, #0c0c11) padding-box, var(--grad-edge) border-box; box-shadow: inset 0 2px 6px rgba(0,0,0,.5); }
.filtro { border: 0; padding: 8px 16px; border-radius: 9px; background: transparent; color: var(--gray-hi); font-weight: 800; font-size: .82rem; white-space: nowrap; transition: background .15s, color .15s, box-shadow .15s; }
.filtro small { opacity: .7; font-weight: 700; margin-left: 4px; }
.filtro:hover { background: rgba(255,255,255,.06); color: #fff; }
.filtro.on { color: #fff; background: linear-gradient(135deg, var(--mg), var(--vio)); box-shadow: 0 3px 0 var(--mg-3), 0 8px 18px rgba(200,62,250,.35); }
.tf-filtros { width: auto; margin-top: 18px; }
.tf-niveis { display: flex; flex-wrap: wrap; gap: 8px 16px; width: 100%; font-size: .78rem; color: var(--gray-hi); }
.tf-niveis b { color: #fff; }
.tf-niveis .nivel-bronze { color: #F6C08D; } .tf-niveis .nivel-prata { color: #E6EAF2; } .tf-niveis .nivel-ouro { color: #FFE68A; } .tf-niveis .nivel-diamante { color: #BDF4FF; } .tf-niveis .nivel-lenda { color: #F3C1FF; }

/* Nome de usuario */
.nick-box { display: flex; align-items: center; border-radius: 10px; border: 1px solid rgba(255,255,255,.15); background: #0c0c11; box-shadow: inset 0 2px 6px rgba(0,0,0,.5); }
.nick-box b { padding: 0 2px 0 12px; color: var(--mg-hi); font-weight: 900; }
.nick-box input { flex: 1; min-width: 0; border: 0 !important; box-shadow: none !important; background: transparent !important; padding-left: 4px !important; }
.nick-box:focus-within { border-color: var(--mg); box-shadow: inset 0 2px 6px rgba(0,0,0,.5), var(--glow); }
.nick-msg { font-size: .74rem; color: var(--muted); min-height: 1.1em; }
.nick-msg.ok { color: #5fd98f; }
.nick-msg.ko { color: #ff7b7b; }

/* Resumo do menu compacto, sem quebra de linha */
.sb-resumo { padding: 8px 4px; gap: 2px; margin-top: 14px; }
.sb-resumo b { font-size: .95rem; line-height: 1.2; }
.sb-resumo span { display: block; font-size: .56rem; letter-spacing: .3px; white-space: nowrap; }

/* Icones do menu com leve cor */
.sb-nav .sb-ic { color: #dcb6ff; background: linear-gradient(180deg, rgba(200,62,250,.16), rgba(124,92,255,.08)); border-color: rgba(200,62,250,.28); }
.sb-nav:nth-child(2) .sb-ic { color: #c9b8ff; }
.sb-nav:nth-child(3) .sb-ic { color: #b9d8ff; }
.sb-nav:nth-child(4) .sb-ic { color: #ffe3a3; }
.sb-nav:nth-child(5) .sb-ic { color: #d6d6e6; }
.sb-nav.active .sb-ic, .sb-nav:hover .sb-ic { color: #fff; }
@media (max-width: 600px) { .filtros { width: 100%; } .filtro { flex: 1; padding: 8px 6px; } .tf-filtros .filtro { flex: none; } }

/* Barra de salvar sempre visivel em Configuracoes */
.save-bar.fixa { position: sticky; bottom: 0; z-index: 25; margin-top: 18px; padding: 12px 16px max(12px, env(safe-area-inset-bottom)); border-radius: 14px; border: 1px solid transparent; background: linear-gradient(180deg, rgba(29,22,40,.97), rgba(18,18,24,.97)) padding-box, var(--grad-edge) border-box; box-shadow: 0 -10px 30px rgba(0,0,0,.55); backdrop-filter: blur(8px); }
.save-bar.fixa .save-txt { margin-right: auto; color: var(--gray-hi); font-size: .82rem; }
.save-bar.fixa .btn { min-width: 170px; justify-content: center; }
@media (max-width: 600px) { .save-bar.fixa .save-txt { display: none; } .save-bar.fixa .btn { flex: 1; } }

/* Aviso de troféu discreto no topo (22/09/2026): fica sobre o cabeçalho, não recebe toques, some sozinho em 3,6 s */
.tf-toast { position: fixed; z-index: 180; top: calc(env(safe-area-inset-top, 0px) + 10px); left: 50%; width: min(92vw, 360px); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border-radius: 14px; pointer-events: none; color: #fff; background: linear-gradient(135deg, rgba(38,22,58,.96), rgba(22,14,36,.96)); border: 1px solid rgba(231,166,255,.45); box-shadow: 0 10px 28px rgba(0,0,0,.45), 0 0 0 1px rgba(124,92,255,.25); animation: tfToast 3.6s cubic-bezier(.2,.8,.2,1) both; }
.tf-toast .tf-t-med { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 50% 35%, rgba(255,255,255,.16), rgba(255,255,255,.04)); }
.tf-toast .tf-svg { width: 26px; height: 26px; }
.tf-toast .tf-t-txt { min-width: 0; display: grid; line-height: 1.25; }
.tf-toast .tf-t-txt b { font-size: .86rem; font-weight: 800; }
.tf-toast .tf-t-txt span { font-size: .78rem; color: var(--gray-hi, #cfc8e0); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes tfToast { 0% { opacity: 0; transform: translate(-50%, -140%); } 9% { opacity: 1; transform: translate(-50%, 0); } 88% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -60%); } }
@media (prefers-reduced-motion: reduce) { .tf-toast { animation: tfToastRM 3.6s linear both; } @keyframes tfToastRM { 0%, 90% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, 0); } } }
body.nick-obrigatorio .tf-toast { display: none !important; }
