/* Pagina «Progressi» (js/stats.js): schede Statistiche | Medaglie (le medaglie hanno medals.css);
   Statistiche: periodo, totali, ore per settimana, programma, palestra, corpo.
   Solo token di colore: chiaro e scuro vanno da soli. */

/* etichetta «Pro» delle funzioni a pagamento (compare solo col pagamento acceso: R.Pro.enabled) */
.pro-tag {
  display: inline-flex; align-items: center; flex: none; margin-left: 6px; padding: 1px 6px; border-radius: 5px; vertical-align: 2px;
  font: 700 10px/1.4 var(--f-body); letter-spacing: .06em; text-transform: uppercase;
  color: color-mix(in srgb, var(--accent) 80%, var(--ink)); background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.sh-top .pro-tag { margin-left: 0; }

/* link nel riepilogo della settimana del calendario */
.ws-stats {
  display: inline-flex; align-items: center; gap: 5px; align-self: flex-start; padding: 4px 2px;
  border: 0; background: transparent; color: var(--accent); font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.ws-stats svg { width: 14px; height: 14px; flex: none; }
.ws-stats:hover { text-decoration: underline; text-underline-offset: 2px; }

/* schede sotto il titolo (come .kp-tabs in feedback.css) */
.seg.sx-tabs { display: flex; width: 100%; max-width: 420px; }
.sx-tabs button { flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; }
.sx-tabs .pro-tag { margin-left: 0; }

/* periodo */
.seg.sx-rg { display: flex; width: 100%; max-width: 520px; margin-top: 12px; }
.sx-rg button { flex: 1 1 0; padding-inline: 4px; }
.sx-from { margin: 6px 0 0 2px; font-size: 12.5px; color: var(--muted); }
.sx-none { margin: 14px 0 0; font-size: 13px; color: var(--muted); }

/* totali: quattro numeri, due per riga sul telefono */
.sx-tot {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; max-width: 560px;
  overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--line);
}
.sx-t { display: flex; flex-direction: column; gap: 1px; min-width: 0; padding: 8px 11px; background: var(--surface-2); }
.sx-t span { font: 600 10.5px/1.2 var(--f-display); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.sx-t b { font: 700 24px/1.1 var(--f-display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sx-t small { overflow: hidden; font-size: 11.5px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }

/* grafici */
.sx-chart { display: block; width: 100%; max-width: 560px; height: auto; margin-top: 4px; }
.sx-grid { stroke: var(--line); stroke-width: 1; }
.sx-yl, .sx-xl { font: 600 9.5px var(--f-body); fill: var(--muted); }
.sx-yl { text-anchor: end; }
.sx-b { fill: var(--c); }
.sx-plan { stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; opacity: .5; }
.sx-dot { fill: color-mix(in srgb, var(--accent) 40%, var(--surface)); }
.sx-avg { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.sx-leg { display: flex; flex-wrap: wrap; gap: 4px 14px; max-width: 560px; margin: 6px 0 0; padding: 0; list-style: none; font-size: 12.5px; color: var(--muted); }
.sx-leg li { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.sx-leg i { width: 9px; height: 9px; border-radius: 2px; background: var(--c); }
.sx-leg b { color: var(--ink); font-weight: 700; }
.sx-leg .sx-k-plan i { width: 14px; height: 0; border-radius: 0; border-top: 1.6px solid var(--ink); background: none; opacity: .5; }
.sx-key { display: flex; align-items: center; gap: 6px; margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.sx-k-dot { width: 7px; height: 7px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 40%, var(--surface)); }
.sx-k-line { width: 16px; height: 3px; margin-left: 8px; border-radius: 2px; background: var(--accent); }

/* fatto rispetto al programma */
.sx-cmp {
  display: flex; flex-direction: column; gap: 8px; max-width: 560px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2);
}
.sx-cmp-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.sx-pct { font: 700 30px/1 var(--f-display); font-variant-numeric: tabular-nums; }
.sx-cmp-h span { font-size: 13px; color: var(--muted); }
.sx-cmp-h span b { color: var(--ink); }
.sx-meter { height: 7px; overflow: hidden; border-radius: 99px; background: color-mix(in srgb, var(--ink) 10%, transparent); }
.sx-meter i { display: block; height: 100%; border-radius: inherit; background: var(--st, var(--ok)); }
.sx-pills { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.sx-pills .pill { font-size: 11.5px; }
.sx-line { margin: 6px 0 0 2px; font-size: 12.5px; color: var(--muted); }
.sx-cmp .sx-line { margin: 0; }
.sx-line b { color: var(--ink); }

/* palestra e corpo */
.sx-sts { margin-top: 2px; }
.sx-h4 { margin: 14px 0 6px 2px; font-size: 14px; font-weight: 700; }
.sec h3 + .sx-h4 { margin-top: 0; }
.sx-rm { max-width: 560px; margin: 0; padding: 0; overflow: hidden; list-style: none; counter-reset: rm; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.sx-rm li { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 12px; counter-increment: rm; }
.sx-rm li + li { border-top: 1px solid var(--line); }
.sx-rm li::before { content: counter(rm); font: 700 15px/1 var(--f-display); color: var(--muted); text-align: center; }
.sx-rm-n { display: flex; flex-direction: column; gap: 1px; min-width: 0; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.sx-rm-n small { font-size: 12px; font-weight: 400; color: var(--muted); }
.sx-rm-n em { font-style: normal; font-weight: 600; }
.sx-up { color: color-mix(in srgb, var(--ok) 80%, var(--ink)); }
.sx-down { color: color-mix(in srgb, var(--missed) 80%, var(--ink)); }
.sx-rm b { font: 700 20px/1 var(--f-display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sx-rm b small { font: 500 11.5px var(--f-body); color: var(--muted); }
.sx-note { margin: 6px 0 0 2px; font-size: 11.5px; color: var(--muted); }

/* esercizi in palestra: una riga per esercizio (nome e giorno | kg dell'ultima volta | freccia), un tocco apre la sua pagina */
.sx-exl { max-width: 560px; margin: 0; padding: 0; overflow: hidden; list-style: none; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.sx-exl li + li { border-top: 1px solid var(--line); }
.sx-exr {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 16px; align-items: center; gap: 10px; width: 100%; min-height: 54px;
  padding: 8px 10px 8px 12px; border: 0; background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.sx-exr:active { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.sx-exn { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sx-exn b { font-size: 14.5px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.sx-exn small { font-size: 12px; color: var(--muted); }
.sx-exv { font: 700 20px/1 var(--f-display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sx-exv small { font: 500 11.5px var(--f-body); color: var(--muted); }
.sx-exch { display: flex; color: var(--muted); }
.sx-exch svg { width: 16px; height: 16px; }
/* «Altri esercizi»: come «Tutte le pesate» in Health */
.sx-exm { max-width: 560px; margin-top: 8px; }
.sx-exm summary { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; cursor: pointer; list-style: none; font-size: 13px; font-weight: 700; color: var(--accent); }
.sx-exm summary::-webkit-details-marker { display: none; }
.sx-exm summary::before { content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 2px 2px 0; rotate: -45deg; transition: rotate .15s; }
.sx-exm[open] summary::before { rotate: 45deg; }
.sx-exm .sx-exl { margin-top: 4px; }

/* la pagina dell'esercizio: sopra i kg della volta scelta, poi il grafico (il dito scorre in orizzontale, la pagina in verticale) */
.sx-exread { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; min-height: 24px; margin: 0; font-size: 12.5px; color: var(--muted); }
.sx-exread b { font: 700 20px/1 var(--f-display); color: var(--ink); font-variant-numeric: tabular-nums; }
.sx-exc { margin-top: 4px; touch-action: pan-y; cursor: crosshair; -webkit-user-select: none; user-select: none; }
.sx-exd { fill: var(--accent); stroke: var(--surface); stroke-width: 1.2; }
.sx-sel line { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.sx-sel circle { fill: var(--accent); stroke: var(--surface); stroke-width: 2.5; }
/* le ultime volte: il giorno a sinistra, le serie (.gh-set di sheets.css) che vanno a capo */
.sx-exs { max-width: 560px; margin: 0; padding: 0; list-style: none; }
.sx-exs li { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 4px 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.sx-exs li:first-child { border-top: 0; padding-top: 0; }
.sx-exs-d { padding-top: 3px; font-size: 12.5px; font-weight: 700; color: var(--muted); }

/* nello storico di un esercizio in palestra (js/gym.js): il link alla pagina col grafico dei kg */
.gh-kg {
  display: flex; align-items: center; gap: 6px; width: 100%; min-height: 40px; padding: 0 10px; border: 0; border-top: 1px solid var(--line);
  background: transparent; color: var(--accent); font: 600 13px var(--f-body); text-align: left; cursor: pointer;
}
.gh-kg svg { flex: none; width: 16px; height: 16px; }

@media (max-width: 560px) {
  .sx-tot { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .ws-stats { min-height: 36px; padding-inline: 4px; font-size: 12px; }
  .sx-chart { margin-top: 2px; }
}
