:root {
  --fundo: #0d0c14;
  --sup: #17151f;
  --sup2: #1f1c29;
  --borda: #2a2636;
  --texto: #ece9f5;
  --fraco: #9a95ab;
  --roxo: #8570e8;
  --roxo-claro: #b9adf5;
  --roxo-tinta: rgba(133, 112, 232, .14);
  --verde: #4ade80;
  --verde-tinta: rgba(74, 222, 128, .12);
  --vermelho: #f87171;
  --brilho: 0 0 20px -4px rgba(133, 112, 232, .55);
  --r: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--fundo); color: var(--texto); }
body {
  font: 500 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) 0 0;
}
main { max-width: 560px; margin: 0 auto; padding: 20px 16px 120px; }
h1 { font-size: 26px; font-weight: 600; margin: 8px 0 4px; letter-spacing: -.01em; }
h2 { font-size: 18px; font-weight: 600; margin: 0 0 10px; }
h3 { font-size: 16px; font-weight: 500; margin: 0; }
p { margin: 0; }
.fraco { color: var(--fraco); }
.peq { font-size: 14px; }
.carregando { color: var(--fraco); text-align: center; margin-top: 40vh; }
.cab { margin-bottom: 18px; }
.linha { display: flex; align-items: center; gap: 10px; }
.entre { justify-content: space-between; }
.cresce { flex: 1; min-width: 0; }

.cartao {
  background: var(--sup);
  border: 1px solid var(--borda);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 12px;
}
.rotulo { font-size: 13px; color: var(--fraco); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.ponto { width: 7px; height: 7px; border-radius: 50%; background: var(--roxo); display: inline-block; }

button, .botao {
  font: inherit; color: inherit; border: 0; cursor: pointer;
  border-radius: 12px; padding: 12px 16px;
  background: var(--sup2); border: 1px solid var(--borda);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; transition: box-shadow .2s;
}
button:active { transform: scale(.98); }
.primario { background: var(--roxo); border-color: var(--roxo); color: #fff; box-shadow: var(--brilho); font-weight: 600; }
.grande { width: 100%; padding: 17px; font-size: 18px; border-radius: 14px; }
.inteiro { width: 100%; }
.texto { background: none; border: 0; color: var(--roxo-claro); padding: 8px 4px; }
.perigo { color: var(--vermelho); }
.mini { padding: 7px 11px; font-size: 14px; border-radius: 10px; }

input, select, textarea {
  font: inherit; color: var(--texto);
  background: var(--fundo); border: 1px solid var(--borda);
  border-radius: 10px; padding: 11px 12px; width: 100%;
  outline: none; transition: box-shadow .2s, border-color .2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--roxo); box-shadow: var(--brilho); }
input::placeholder { color: #625d73; }
label { display: block; font-size: 14px; color: var(--fraco); margin: 12px 0 6px; }

/* semana */
.semana { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 10px; }
.semana div { text-align: center; font-size: 12px; color: var(--fraco); }
.semana span {
  display: grid; place-items: center; margin: 4px auto 0;
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--borda); font-size: 13px; color: var(--fraco);
}
.semana .foi span { background: var(--roxo); border-color: var(--roxo); color: #fff; box-shadow: var(--brilho); }
.semana .hoje span { border-color: var(--roxo-claro); color: var(--texto); }
.grandao { font-size: 34px; font-weight: 500; letter-spacing: -.02em; }

/* treino em andamento */
.topo-treino {
  position: sticky; top: 0; z-index: 5; margin: calc(-20px - env(safe-area-inset-top)) -16px 14px; padding: 14px 16px;
  padding-top: calc(14px + env(safe-area-inset-top));
  background: rgba(13, 12, 20, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--borda);
}
.relogio { font-variant-numeric: tabular-nums; color: var(--roxo-claro); }
.ex { transition: opacity .2s; }
.ex.feito { opacity: .55; }
.ex .meta { font-size: 13px; color: var(--fraco); white-space: nowrap; }
.ultima { font-size: 13px; color: var(--fraco); margin-top: 4px; }
.sobe { font-size: 13px; color: var(--verde); margin-top: 4px; }
.dica { font-size: 13px; color: var(--fraco); margin-top: 4px; font-style: italic; }
.serie { display: grid; grid-template-columns: 22px 1fr 1fr 48px; gap: 8px; align-items: center; margin-top: 8px; }
.serie.so1 { grid-template-columns: 22px 1fr 48px; }
.serie .n { color: var(--fraco); font-size: 14px; text-align: center; }
.serie input { text-align: center; padding: 12px 6px; font-size: 17px; }
.serie .uni { position: relative; }
.serie .uni small { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); color: #625d73; font-size: 12px; pointer-events: none; }
.check {
  width: 48px; height: 48px; padding: 0; border-radius: 12px; font-size: 20px; color: var(--fraco);
}
.check.ok { background: var(--verde-tinta); border-color: var(--verde); color: var(--verde); }
.serie.ok input { border-color: rgba(74, 222, 128, .35); }

#descanso {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom));
  width: min(528px, calc(100% - 32px)); z-index: 20;
  background: var(--sup2); border: 1px solid var(--roxo); box-shadow: var(--brilho);
  border-radius: 16px; padding: 12px 14px; display: flex; align-items: center; gap: 10px;
}
#descanso .tempo { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; flex: 1; }
#descanso.acabou { border-color: var(--verde); box-shadow: 0 0 22px -4px rgba(74, 222, 128, .6); }
#descanso.acabou .tempo { color: var(--verde); }

/* abas */
#abas {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; justify-content: center;
  background: rgba(13, 12, 20, .94); backdrop-filter: blur(10px);
  border-top: 1px solid var(--borda);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
#abas a {
  flex: 1; max-width: 140px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--fraco); text-decoration: none; font-size: 12px; padding: 6px 0; border-radius: 12px;
}
#abas svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#abas a.ativa { color: var(--roxo-claro); }
#abas a.ativa svg { filter: drop-shadow(0 0 6px rgba(133, 112, 232, .7)); }

/* calendário */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; }
.cal .sem { font-size: 12px; color: var(--fraco); padding-bottom: 2px; }
.cal button {
  aspect-ratio: 1; padding: 0; border-radius: 12px; font-size: 15px;
  background: transparent; border: 1px solid transparent; color: var(--texto);
}
.cal button.fora { visibility: hidden; }
.cal button.futuro { color: #4d4859; }
.cal button.hoje { border-color: var(--roxo-claro); }
.cal button.foi { background: var(--roxo); color: #fff; box-shadow: var(--brilho); }
.cal button.sel { outline: 2px solid var(--roxo-claro); outline-offset: 2px; }

/* listas */
.item {
  display: flex; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid var(--borda);
}
.item:first-child { border-top: 0; padding-top: 2px; }
.item .acoes { display: flex; gap: 4px; }
.item .acoes button { padding: 7px 9px; border-radius: 9px; font-size: 14px; background: transparent; }
.clicavel { cursor: pointer; }
.pilula {
  display: inline-block; font-size: 12px; padding: 3px 9px; border-radius: 999px;
  background: var(--roxo-tinta); color: var(--roxo-claro);
}
.pilula.verde { background: var(--verde-tinta); color: var(--verde); }
.abas-fichas { display: flex; gap: 8px; margin-bottom: 12px; overflow-x: auto; }
.abas-fichas button { white-space: nowrap; }
.abas-fichas .ativa { border-color: var(--roxo); color: var(--roxo-claro); box-shadow: var(--brilho); }

/* gráfico */
.grafico { width: 100%; height: auto; display: block; margin-top: 6px; }
.grafico .ln { fill: none; stroke: var(--roxo); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 0 5px rgba(133, 112, 232, .6)); }
.grafico .pt { fill: var(--fundo); stroke: var(--roxo-claro); stroke-width: 2; }
.grafico text { fill: var(--fraco); font-size: 11px; font-family: inherit; }
.grafico .grade { stroke: var(--borda); stroke-width: 1; }

/* folha (modal de baixo) */
#folha {
  position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .6);
  display: flex; align-items: flex-end; justify-content: center;
}
#folha .caixa {
  background: var(--sup); border: 1px solid var(--borda); border-bottom: 0;
  border-radius: 20px 20px 0 0; width: 100%; max-width: 560px;
  max-height: 88dvh; overflow-y: auto;
  padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
  animation: sobe .2s ease-out;
}
@keyframes sobe { from { transform: translateY(30px); opacity: 0; } }
.botoes { display: flex; gap: 10px; margin-top: 16px; }
.botoes > * { flex: 1; }
.grade2 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.grade2 label { margin-top: 0; }

.login { max-width: 360px; margin: 18vh auto 0; text-align: center; }
.login .logo { width: 72px; height: 72px; border-radius: 20px; box-shadow: var(--brilho); margin-bottom: 14px; }
.erro { color: var(--vermelho); font-size: 14px; min-height: 20px; margin-top: 8px; }
.aviso-off { font-size: 13px; color: var(--fraco); text-align: center; margin-bottom: 10px; }

/* ficha: número do exercício e botão de ícone */
.num {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--roxo-tinta); color: var(--roxo-claro); font-size: 13px;
}
.icone { padding: 9px; border-radius: 12px; margin-top: 6px; }
.icone svg { width: 20px; height: 20px; fill: none; stroke: var(--fraco); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.item p:first-child:not(.fraco) { line-height: 1.3; }
