:root {
  --bg: #0c0d10;
  --card: #16181d;
  --card2: #1e2128;
  --linha: #2a2e37;
  --txt: #eef0f3;
  --mut: #9aa1ad;
  --acc: #c8f031;      /* work-set / ação principal */
  --acc-txt: #11140a;
  --prep: #7d8696;
  --mr: #b28cff;
  --ok: #46d37e;
  --alerta: #ffb347;
  --perigo: #ff6b6b;
  --r: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); color-scheme: dark; }
body {
  margin: 0; background: var(--bg); color: var(--txt);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
}
#app { max-width: 560px; margin: 0 auto; padding: calc(env(safe-area-inset-top, 0px) + 8px) 14px calc(96px + var(--safe-b)); }
body.com-timer #app { padding-bottom: calc(176px + var(--safe-b)); }
a { color: var(--acc); }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
.mut { color: var(--mut); }
.pequeno { font-size: 14px; }
.carregando { text-align: center; color: var(--mut); margin-top: 40vh; }
.vazio { text-align: center; margin: 40px 0; }

/* topo */
.topo { display: flex; align-items: center; gap: 10px; min-height: 52px; margin-bottom: 8px; flex-wrap: wrap; }
.topo h1 { font-size: 22px; flex: 1; min-width: 0; }
.voltar { font-size: 34px; line-height: 1; text-decoration: none; color: var(--txt); padding: 0 8px 4px 0; }
.data-topo { font-size: 15px; }
.sync { font-size: 12px; color: var(--mut); width: 100%; order: 9; margin-top: -4px; }
.sync.ok { color: var(--mut); }
.sync.pendente { color: var(--mut); }
.sync.offline { color: var(--alerta); }
.sync.erro { color: var(--perigo); }

/* cards */
.card { display: block; background: var(--card); border-radius: var(--r); padding: 16px; margin-bottom: 12px; text-decoration: none; color: inherit; }
.card h2 { font-size: 18px; margin-bottom: 8px; }
.card.destaque { background: var(--card2); }
.card.compacto { padding: 12px 14px; }
.card.compacto h2 { font-size: 16px; }
.linha { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.lista-ex { margin: 6px 0 14px; padding-left: 22px; color: var(--mut); font-size: 15px; }
.lista-ex li { padding: 2px 0; }
.ok { color: var(--ok); font-weight: 600; margin: 6px 0 12px; }
.nota { white-space: pre-wrap; background: var(--card2); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.andamento { border: 1.5px solid var(--acc); display: flex; flex-direction: column; gap: 2px; }
.andamento span:first-child { font-size: 13px; color: var(--acc); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.andamento b { font-size: 20px; }
.aviso { color: var(--alerta); font-weight: 600; }
.aviso-box { background: #3a2a10; color: var(--alerta); border-radius: 10px; padding: 10px 12px; }

/* botões */
.btn {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 50px; margin: 8px 0 0;
  border: 0; border-radius: 12px; background: var(--card2); color: var(--txt); font: inherit; font-weight: 650;
  text-decoration: none; cursor: pointer; padding: 0 16px;
}
.btn.grande { background: var(--acc); color: var(--acc-txt); min-height: 58px; font-size: 18px; margin-top: 14px; }
.btn.sec { background: var(--card2); border: 1px solid var(--linha); }
.card.destaque .btn.sec { background: var(--card); }
.btn.ok-btn { background: var(--acc); color: var(--acc-txt); }
.btn.perigo { background: transparent; color: var(--perigo); border: 1px solid #4a2a2a; margin-top: 28px; }
.btn:active, .chip:active, .feito:active { transform: scale(.98); }
.link { background: none; border: 0; color: var(--acc); font: inherit; padding: 0; text-decoration: underline; cursor: pointer; }
.sub { font-size: 14px; text-transform: uppercase; letter-spacing: .07em; color: var(--mut); margin: 22px 2px 10px; font-weight: 700; }

.grade-treinos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.chip {
  min-height: 56px; border-radius: 12px; border: 1px solid var(--linha); background: var(--card); color: var(--txt);
  font: inherit; font-weight: 650; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer;
}
.chip small { font-size: 11px; color: var(--mut); font-weight: 500; }
.chip.sel { border-color: var(--acc); color: var(--acc); }

/* formulário */
textarea, input {
  font: inherit; color: var(--txt); background: var(--bg); border: 1px solid var(--linha); border-radius: 10px;
  padding: 12px; width: 100%; font-size: 16px;
}
textarea { resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--acc); outline-offset: -1px; border-color: transparent; }
.rot { display: block; font-size: 14px; color: var(--mut); margin: 4px 0 6px; }

/* login */
.login { max-width: 320px; margin: 18vh auto 0; text-align: center; }
.login h1 { font-size: 28px; margin-bottom: 28px; }
.login label { display: block; text-align: left; color: var(--mut); margin-bottom: 6px; }
.login input { font-size: 24px; text-align: center; letter-spacing: .3em; }
.erro { color: var(--perigo); min-height: 1.4em; }

/* treino */
.legenda { margin: -2px 2px 12px; }
.ex-topo { display: flex; align-items: flex-start; gap: 10px; }
.ex-topo h2 { flex: 1; font-size: 18px; margin: 0; }
.ex-n { display: inline-flex; width: 24px; height: 24px; border-radius: 50%; background: var(--card2); color: var(--mut); font-size: 13px; align-items: center; justify-content: center; margin-right: 8px; vertical-align: 2px; }
.card.ex.completo .ex-n { background: var(--ok); color: #06140b; }
.tempo { font-size: 12px; color: var(--mut); border: 1px solid var(--linha); border-radius: 6px; padding: 2px 6px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ex-links { display: flex; gap: 16px; align-items: center; margin: 8px 0 4px; font-size: 15px; }
.ex-links a { text-decoration: none; font-weight: 600; padding: 6px 0; }
.ex-links .mut { margin-left: auto; font-variant-numeric: tabular-nums; }
.obs { font-size: 14px; color: var(--mut); margin: 4px 0 6px; background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.ultima { font-size: 14px; margin: 6px 0; font-variant-numeric: tabular-nums; }
.ultima i { font-style: normal; color: var(--mut); font-size: 12px; }
.sugestao { font-size: 14px; margin: 6px 0 10px; padding: 8px 10px; border-radius: 8px; background: var(--card2); }
.sugestao.subir { color: var(--acc); }
.sugestao.baixar { color: var(--alerta); }
.sugestao.solto { margin: 0 0 12px; }

.serie { border-top: 1px solid var(--linha); padding: 12px 0 4px; }
.s-meta { font-size: 13px; color: var(--mut); margin-bottom: 8px; }
.s-meta b { color: var(--txt); font-size: 14px; margin-right: 4px; }
.serie.prep .s-meta b { color: var(--prep); }
.serie.ws .s-meta b { color: var(--acc); }
.serie.mr .s-meta b { color: var(--mr); }
.lutador { font-size: 11px; border: 1px solid var(--mr); color: var(--mr); border-radius: 4px; padding: 0 4px; }
.s-campos { display: flex; gap: 8px; align-items: flex-end; }
.campo { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.campo.kg { flex: 1.25; }
.campo span { font-size: 12px; color: var(--mut); margin-bottom: 3px; }
.campo input { height: 50px; text-align: center; font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; padding: 0 4px; }
.campo input::placeholder { color: #5b616d; font-weight: 500; }
.campo input.falta { outline: 2px solid var(--alerta); }
.feito {
  flex: 0 0 56px; height: 50px; border-radius: 12px; border: 1.5px solid var(--linha); background: transparent;
  color: var(--mut); font-size: 22px; font-weight: 800; cursor: pointer;
}
.serie.feita .feito { background: var(--ok); border-color: var(--ok); color: #06140b; }
.serie.feita .campo input { color: var(--ok); border-color: #24452f; }
.rir { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.rir span { font-size: 12px; color: var(--mut); width: 52px; }
.rir button { flex: 1; height: 40px; border-radius: 10px; border: 1px solid var(--linha); background: transparent; color: var(--txt); font: inherit; font-weight: 650; cursor: pointer; }
.rir button.sel { background: var(--acc); color: var(--acc-txt); border-color: var(--acc); }
.blocos { flex: 1.1; display: flex; flex-direction: column; }
.blocos > span { font-size: 12px; color: var(--mut); margin-bottom: 3px; }
.blocos > div { display: flex; align-items: center; height: 50px; border: 1px solid var(--linha); border-radius: 10px; }
.blocos button { width: 44px; height: 100%; border: 0; background: transparent; color: var(--mut); font-size: 24px; cursor: pointer; }
.blocos b { flex: 1; text-align: center; font-size: 22px; font-variant-numeric: tabular-nums; color: var(--mr); padding-right: 12px; }
.mr-acoes { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; }
.mr-acoes .btn:first-child { background: #2a2145; color: var(--mr); }

.extras .check, .card > .check { margin-top: 8px; }
.check {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; background: var(--card2); border: 1px solid var(--linha);
  border-radius: 12px; padding: 12px; color: var(--txt); font: inherit; cursor: pointer; min-height: 58px;
}
.check small { display: block; color: var(--mut); font-size: 13px; margin-top: 2px; }
.caixa { flex: 0 0 28px; height: 28px; border-radius: 8px; border: 1.5px solid var(--mut); display: flex; align-items: center; justify-content: center; font-weight: 800; }
.check.sel .caixa { background: var(--acc); border-color: var(--acc); color: var(--acc-txt); }

/* timer */
#timer {
  position: fixed; left: 10px; right: 10px; bottom: calc(70px + var(--safe-b)); z-index: 20; max-width: 540px; margin: 0 auto;
  background: #1f2a0a; border: 1.5px solid var(--acc); border-radius: 16px; padding: 10px 10px 10px 16px;
  display: flex; align-items: center; gap: 8px; overflow: hidden; box-shadow: 0 10px 30px #000a;
}
#timer[hidden] { display: none; }
.t-barra { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--acc); transform-origin: left; transition: transform .25s linear; }
.t-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.t-txt b { font-size: 34px; line-height: 1.05; font-variant-numeric: tabular-nums; color: var(--acc); }
.t-txt span { font-size: 13px; color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-btn { height: 52px; min-width: 70px; border-radius: 12px; border: 0; background: #33421a; color: var(--txt); font: inherit; font-weight: 700; cursor: pointer; }
#timer.acabou { background: var(--acc); animation: pisca .5s ease-in-out 6 alternate; }
#timer.acabou .t-txt b { color: var(--acc-txt); }
#timer.acabou .t-txt span { color: #3a4512; }
#timer.acabou .t-btn { background: var(--acc-txt); color: var(--acc); }
@keyframes pisca { to { filter: brightness(1.25); } }

/* navegação */
#nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; background: #0f1014ee;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--linha);
  padding-bottom: var(--safe-b);
}
#nav[hidden] { display: none; }
#nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 60px; color: var(--mut); text-decoration: none; font-size: 12px; font-weight: 600; }
#nav .ni { font-size: 18px; line-height: 1.2; }
#nav a.ativo { color: var(--acc); }

/* listas / histórico */
.abas { display: flex; background: var(--card); border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.abas a { flex: 1; text-align: center; padding: 10px; border-radius: 9px; text-decoration: none; color: var(--mut); font-weight: 650; }
.abas a.sel { background: var(--card2); color: var(--txt); }
.lista { list-style: none; margin: 0 0 12px; padding: 0; background: var(--card); border-radius: var(--r); overflow: hidden; }
.lista li + li { border-top: 1px solid var(--linha); }
.lista a, .lista.semana li { display: flex; flex-wrap: wrap; gap: 2px 10px; padding: 13px 14px; color: var(--txt); text-decoration: none; align-items: baseline; }
.l-data { font-variant-numeric: tabular-nums; color: var(--mut); width: 64px; font-size: 14px; }
.l-nome { font-weight: 650; flex: 1; }
.lista a > .mut { width: 100%; padding-left: 0; font-size: 13px; }
.lista.semana li.hoje { background: #1c2210; }
.lista.semana .l-plan { flex: 1; font-size: 14px; }
.lista.semana .l-feito { width: 100%; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.feito-tag { background: #173322; color: var(--ok); border-radius: 8px; padding: 4px 8px; font-size: 13px; text-decoration: none; font-weight: 600; }
.feito-tag.jiu { background: #22193a; color: var(--mr); }
.falta { color: #6b7280; font-size: 13px; }
.semana-nav { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; margin-bottom: 12px; }
.semana-nav .btn { margin: 0; min-height: 44px; }
.nums { display: flex; gap: 10px; }
.nums > div { flex: 1; display: flex; flex-direction: column; }
.nums b { font-size: 26px; font-variant-numeric: tabular-nums; }
.nums span { font-size: 12px; color: var(--mut); }
.card.destaque h2 + .nums { margin-top: 10px; }
.prox { padding: 10px 0; border-bottom: 1px solid var(--linha); display: flex; flex-direction: column; gap: 4px; }
.prox:last-child { border-bottom: 0; }
.prox .sugestao { margin: 0; }
.tab { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.tab td { padding: 5px 4px; border-top: 1px solid var(--linha); }
.tab td:first-child { color: var(--mut); }

/* gráficos */
.graf { width: 100%; height: auto; display: block; }
.g-linha { fill: none; stroke: var(--acc); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.g-ponto { fill: var(--card); stroke: var(--acc); stroke-width: 2; }
.g-grade { stroke: var(--linha); stroke-dasharray: 3 4; }
.g-txt { fill: var(--mut); font-size: 11px; font-family: inherit; }
.conta { margin: 24px 2px 0; }
