/* styles.css — interfaccia ispirata a Hevy.
   Palette estratta dall'APK (src/theme): primary #008CFF, greyHiperDark #161618,
   greyUltraDark #1C1C1E, greyDark #2C2C2E, grey #83898F, greyMedium #AEB3B7. */

@font-face {
  font-family: "Figtree";
  src: url("../fonts/Figtree-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("../fonts/Figtree-Medium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("../fonts/Figtree-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("../fonts/Figtree-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  --primary: #008cff;
  --primary-dark: #2d4157;
  --primary-hiper-dark: #00192e;
  --primary-light: #eef7ff;
  --green: #56bd23;
  --green-bright: #2acc58;
  --red: #e34b37;
  --red-medium: #ff4b4b;
  --yellow: #f7d000;
  --gold: #f7ab00;

  --bg: #161618;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --border: #2c2c2e;
  --text: #ffffff;
  --text-2: #aeb3b7;
  --text-3: #83898f;
  --nav-bg: #1c1c1e;
  --input-bg: #2c2c2e;

  --radius: 12px;
  --radius-lg: 16px;
  --tab-h: 60px;
}

[data-theme="light"] {
  --bg: #f7f9fb;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --border: #e4e6e9;
  --text: #000a1e;
  --text-2: #2d4157;
  --text-3: #83898f;
  --nav-bg: #ffffff;
  --input-bg: #f2f4f7;
  --primary-light: #eef7ff;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

.app-shell {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(var(--tab-h) + 24px + env(safe-area-inset-bottom));
  position: relative;
}

/* ---------- Header ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
}
.app-header h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}
.app-header .logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 22px;
  font-weight: 700;
}
.app-header .logo svg { width: 28px; height: 28px; }
.header-actions { display: flex; gap: 8px; }

/* ---------- Tab bar ---------- */
.tab-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 520px;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: var(--nav-bg);
  border-top: 1px solid var(--border);
  z-index: 30;
}
.tab-bar button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
}
.tab-bar button svg { width: 24px; height: 24px; }
.tab-bar button.active { color: var(--primary); }

/* ---------- Card & liste ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin: 0 16px 12px;
}
.card h2 { font-size: 16px; margin: 0 0 12px; }
.section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-3);
  margin: 20px 16px 8px;
}
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0 16px 8px;
  color: var(--text);
  width: calc(100% - 32px);
  text-align: left;
}
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; font-size: 15px; }
.list-item .subtitle { color: var(--text-3); font-size: 13px; margin-top: 2px; }
.list-item .chevron { color: var(--text-3); }

/* ---------- Bottoni ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 600;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--red-medium); color: #fff; }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-block { width: 100%; }
/* Bottoni figli diretti di #view (bottoni di pagina): stessa griglia di card e
   liste — gutter 16px. Senza questo, width:100% + margini laterali fa sporgere
   il bottone di 16px oltre il bordo pagina (scroll orizzontale). */
#view > .btn-block, .detail-body > .btn-block { width: calc(100% - 32px); margin-left: 16px; margin-right: 16px; }
.btn-sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: 0.5; cursor: default; }

.fab-start {
  margin: 8px 16px 16px;
  padding: 16px;
  font-size: 17px;
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0, 140, 255, 0.35);
}

/* ---------- Chip / filtri ---------- */
.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 16px 12px;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- Input ---------- */
.field {
  display: block;
  margin: 0 16px 12px;
}
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}
.input, select.input, textarea.input {
  width: 100%;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 15px;
}
textarea.input { min-height: 80px; resize: vertical; }
.input:focus { outline: 2px solid var(--primary); border-color: var(--primary); }

/* ---------- Logger serie (tabella Hevy) ---------- */
.exercise-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin: 0 16px 12px;
  overflow: hidden;
}
.exercise-block .ex-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 6px;
}
.exercise-block .ex-title {
  font-weight: 700;
  font-size: 15px;
  background: none;
  border: none;
  color: var(--text);
  text-align: left;
  padding: 0;
}
.exercise-block .ex-prev {
  color: var(--text-3);
  font-size: 12px;
  padding: 0 14px 8px;
}
.sets-table { width: 100%; border-collapse: collapse; }
.sets-table th {
  font-size: 10.5px;
  letter-spacing: 0.5px;
  color: var(--text-3);
  font-weight: 700;
  text-transform: uppercase;
  padding: 6px 4px;
}
.sets-table td { padding: 4px; text-align: center; }
.sets-table .set-index {
  width: 34px;
  font-weight: 700;
  color: var(--text-2);
}
.sets-table .set-index.warmup { color: var(--gold); }
.sets-table .set-index.drop { color: var(--green-bright); }
.sets-table .set-index.failure { color: var(--red-medium); }
.sets-table input {
  width: 100%;
  min-width: 52px;
  background: var(--input-bg);
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  padding: 8px 4px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
}
.sets-table input:focus { outline: none; border-color: var(--primary); }
.sets-table .prev-value { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.set-check {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 2px solid var(--text-3);
  background: transparent;
  color: transparent;
  font-size: 15px;
  font-weight: 800;
}
.set-check.done { background: var(--green); border-color: var(--green); color: #fff; }
.set-actions { display: flex; gap: 6px; padding: 8px 12px 12px; }

/* ---------- Timer / header workout live ---------- */
.live-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
}
.live-timer {
  font-variant-numeric: tabular-nums;
  font-size: 28px;
  font-weight: 700;
}
.rest-bar {
  position: sticky;
  top: 56px;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 16px 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--primary-hiper-dark);
  border: 1px solid var(--primary-dark);
}
[data-theme="light"] .rest-bar { background: var(--primary-light); border-color: #d7ecff; }
.rest-bar .time { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Grafici ---------- */
.chart-wrap { width: 100%; overflow: hidden; }
.chart-wrap canvas { width: 100%; height: 200px; display: block; }
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding: 8px 0; }
.bar-chart .bar {
  flex: 1;
  background: var(--primary);
  border-radius: 6px 6px 0 0;
  min-height: 3px;
  position: relative;
}
.bar-chart .bar span {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--text-3);
}
.muscle-bar { margin-bottom: 10px; }
.muscle-bar .label-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 4px;
}
.muscle-bar .track {
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.muscle-bar .fill { height: 100%; background: var(--primary); border-radius: 999px; }

/* ---------- Stat riquadri ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 0 16px 12px;
}
.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.stat-box .value { font-size: 22px; font-weight: 700; }
.stat-box .label { color: var(--text-3); font-size: 12px; margin-top: 2px; }

/* ---------- Modal / toast ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
}
.modal {
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
}
.modal h3 { margin: 0 0 12px; font-size: 18px; }
.modal .modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal .modal-actions .btn { flex: 1; }

#toast-host {
  position: fixed;
  bottom: calc(var(--tab-h) + 16px);
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  animation: toast-in 0.2s ease-out;
}
.toast.error { background: var(--red-medium); color: #fff; border: none; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Varie ---------- */
.empty-state {
  text-align: center;
  color: var(--text-3);
  padding: 48px 24px;
  white-space: pre-line;
  font-size: 15px;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--text-2);
}
.badge.pro { background: var(--gold); color: #000; }
.badge.green { background: var(--green); color: #fff; }
.thumb {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--surface-2);
  flex: none;
}
.thumb.placeholder { display: flex; align-items: center; justify-content: center; }
.divider { height: 1px; background: var(--border); margin: 12px 16px; }
.muted { color: var(--text-3); font-size: 13px; }
.warn-box {
  margin: 0 16px 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 13px;
  line-height: 1.45;
}
[data-theme="dark"] .warn-box { background: var(--primary-hiper-dark); color: var(--text-2); }
sup.set-tag {
  font-size: 9px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}
sup.set-tag.warmup { background: var(--gold); color: #000; }
sup.set-tag.drop { background: var(--green-bright); color: #fff; }
sup.set-tag.failure { background: var(--red-medium); color: #fff; }

.pill-tabs {
  display: flex;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 4px;
  margin: 0 16px 14px;
}
.pill-tabs button {
  flex: 1;
  padding: 9px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font-weight: 600;
  font-size: 14px;
}
.pill-tabs button.active { background: var(--primary); color: #fff; }

@media (min-width: 720px) {
  .app-shell { max-width: 560px; }
}

/* ===== Pill allenamento minimizzato (sopra la tab bar) ===== */
.workout-pill {
  position: fixed;
  bottom: calc(var(--tab-h) + 8px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: min(520px, calc(100% - 20px));
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  z-index: 40;
}
.workout-pill .pill-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--green-bright); flex: none;
}
.workout-pill .pill-main {
  flex: 1; display: flex; gap: 6px; align-items: baseline;
  background: none; border: none; color: var(--text);
  font-size: 14px; padding: 0; text-align: left; overflow: hidden;
}
.workout-pill .pill-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workout-pill .pill-icon {
  width: 32px; height: 32px; border: none; border-radius: 8px;
  background: var(--surface); color: var(--text-2); flex: none;
}

/* ===== Logger: barra stats + mappa muscolare ===== */
.live-stats {
  display: flex; align-items: center; gap: 12px;
  margin: 0 16px 12px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.live-stats-figures { display: flex; flex: 1; gap: 6px; }
.live-stats-figures .stat-box { flex: 1; background: none; padding: 4px 0; }
.live-stats-figures .stat-box .value { font-size: 17px; }
.live-stats-body { flex: none; }

/* ===== Mappa corpo fronte/retro ===== */
.body-graph { display: flex; gap: 8px; justify-content: center; }
.body-side { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.body-label { font-size: 11px; color: var(--text-3); text-transform: lowercase; }
.body-graph-wrap { display: flex; justify-content: center; padding: 10px 0 4px; }

/* ===== Tabella serie: riga completata e badge tipo ===== */
.sets-table tr.done td { background: rgba(86, 189, 35, 0.16); }
.sets-table tr.done td:first-child { border-radius: 8px 0 0 8px; }
.sets-table tr.done td:last-child { border-radius: 0 8px 8px 0; }
.set-badge {
  min-width: 26px; height: 26px; padding: 0 6px;
  border: none; border-radius: 7px; cursor: pointer;
  font-size: 12px; font-weight: 800; color: #fff; background: var(--surface-2);
}
.set-badge.normal { background: #2c2c2e; color: #fff; }
.set-badge.warmup { background: var(--gold); color: #000; }
.set-badge.failure { background: var(--red-medium); color: #fff; }
.set-badge.drop { background: #2f7fe0; color: #fff; }
.set-badge.remove { background: var(--red-medium); color: #fff; }

/* ===== Menu tipo di serie (bottom sheet) ===== */
.set-type-list { display: flex; flex-direction: column; }
.set-type-row { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); }
.set-type-choice {
  flex: 1; display: flex; align-items: center; gap: 12px;
  padding: 12px 4px; background: none; border: none;
  color: var(--text); font-size: 15px; text-align: left; cursor: pointer;
}
.set-type-choice.remove { border-top: 1px solid var(--border); color: var(--red-medium); }

/* ===== Picker multi-selezione ===== */
.picker-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin: -4px 0 10px;
}
.picker-title { font-size: 17px; font-weight: 700; }
.picker-footer {
  position: sticky; bottom: 0; padding: 12px 0 4px;
  background: linear-gradient(transparent, var(--surface) 30%);
}
.exercise-row.selected { background: rgba(0, 140, 255, 0.12); }

/* ===== Istruzioni "Come fare" ===== */
.step-list { margin: 6px 0 16px; padding-left: 22px; }
.step-list li { margin-bottom: 10px; line-height: 1.5; font-size: 15px; }

/* ===== Ultimi 7 giorni: strip giorni ===== */
.day-strip { display: flex; gap: 6px; margin-bottom: 6px; }
.day-chip {
  flex: 1; padding: 10px 0; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); color: var(--text-3); font-weight: 700; cursor: pointer;
}
.day-chip.trained { color: var(--text); border-color: var(--primary); }
.day-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ===== Card di condivisione ===== */
.share-wrap { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.share-canvas { width: 100%; max-width: 300px; border-radius: 14px; }
.share-actions { display: flex; gap: 10px; width: 100%; }
.share-actions .btn { flex: 1; }

/* ===== Esercizi: immagini, picker e dettaglio ===== */
.thumb-img {
  width: 46px; height: 46px; border-radius: 50%; flex: none;
  object-fit: cover; background: #f1f2f4; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.exercise-row { align-items: center; gap: 12px; }
.exercise-row .title { font-weight: 600; }
.info-btn {
  width: 26px; height: 26px; border-radius: 50%; border: none; flex: none;
  background: var(--surface-2); color: var(--text-3);
  font-size: 13px; font-weight: 700; font-style: italic; cursor: pointer;
}
.picker-filters { display: flex; gap: 10px; margin: 10px 0; flex-wrap: wrap; }
.picker-filter {
  flex: 1; min-width: 140px; padding: 12px 14px; border: none;
  border-radius: 10px; background: var(--surface-2); color: var(--text);
  font-size: 15px; font-weight: 600; cursor: pointer;
}
.picker-filter.active { background: var(--primary); color: #fff; }
.icon-list { display: flex; flex-direction: column; }
.icon-list-item {
  display: flex; align-items: center; gap: 14px; padding: 10px 4px;
  background: none; border: none; border-bottom: 1px solid var(--border);
  color: var(--text); font-size: 15px; text-align: left; cursor: pointer;
}
.icon-circle { flex: none; display: flex; }
.type-list-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 4px;
  background: none; border: none; border-bottom: 1px solid var(--border);
  color: var(--text); text-align: left; cursor: pointer;
}
.type-list-item .subtitle { margin: 4px 0 8px; }
.chip.static { pointer-events: none; padding: 4px 10px; font-size: 12px; background: var(--surface-2); }
.sub-tabs {
  display: flex; gap: 4px; margin-bottom: 12px; overflow-x: auto;
  border-bottom: 1px solid var(--border);
}
.sub-tab {
  flex: none; padding: 12px 14px; background: none; border: none;
  border-bottom: 2px solid transparent; color: var(--text-3);
  font-size: 15px; font-weight: 600; cursor: pointer;
}
.sub-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.hero-media {
  background: #fff; border-radius: 14px; padding: 10px; position: relative;
  display: flex; justify-content: center; margin: 12px 0;
}
.hero-img { width: 100%; max-height: 300px; object-fit: contain; border-radius: 8px; display: block; }
.hero-video { width: 100%; max-height: 320px; border-radius: 8px; background: #000; display: block; object-fit: contain; }
.media-wrap .hero-video { cursor: pointer; }
/* pulsante pausa/play in alto a destra, come nell'app ufficiale */
.media-toggle {
  position: absolute; top: 18px; right: 18px; z-index: 2;
  width: 38px; height: 38px; border: none; border-radius: 50%;
  background: rgba(0, 0, 0, 0.45); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.media-toggle.paused { background: rgba(0, 140, 255, 0.85); }
.media-wrap.is-loading::after {
  content: ""; position: absolute; width: 26px; height: 26px; left: 0; right: 0; bottom: 14px; margin: auto;
  border: 2.5px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; border-radius: 50%;
  animation: media-spin 0.8s linear infinite;
}
@keyframes media-spin { to { transform: rotate(360deg); } }
.video-play-overlay {
  position: absolute; inset: 0; margin: auto; width: 64px; height: 64px;
  border: none; border-radius: 50%; background: rgba(0, 0, 0, 0.55); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.detail-info { margin: 6px 2px 14px; }
.tip-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; color: var(--primary); font-weight: 600; }
.empty-media {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 28px 0; color: var(--text-3);
}
.pr-list { padding: 4px 16px; }
.pr-row {
  display: flex; justify-content: space-between; gap: 16px; padding: 16px 0;
  border-bottom: 1px solid var(--border); font-size: 15px;
}
.pr-row:last-child { border-bottom: none; }
.pr-value { color: var(--text); font-weight: 600; text-align: right; }
.pinned-head { display: flex; justify-content: space-between; align-items: center; }
.link-btn {
  background: none; border: none; color: var(--primary);
  font-size: 15px; font-weight: 600; cursor: pointer; padding: 4px 0;
}
/* creazione esercizio a schermo intero */
.full-screen {
  position: fixed; inset: 0; z-index: 90; background: var(--bg);
  overflow-y: auto; padding-bottom: 32px;
}
.full-body { padding: 16px; }
.photo-block { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 18px 0 26px; }
.photo-circle {
  width: 108px; height: 108px; border-radius: 50%;
  border: 1.5px solid var(--text-3); overflow: hidden;
  display: flex; align-items: center; justify-content: center; color: var(--text-3);
}
.photo-circle img { width: 100%; height: 100%; object-fit: cover; }
.create-name {
  border: none; border-bottom: 1px solid var(--border); border-radius: 0;
  padding: 12px 2px; font-size: 17px;
}
.selector-rows { margin-top: 8px; }
.selector-row {
  display: flex; align-items: center; width: 100%; padding: 16px 2px;
  background: none; border: none; border-bottom: 1px solid var(--border);
  color: var(--text); text-align: left; cursor: pointer;
}
.selector-row .title { font-size: 16px; font-weight: 600; }
.select-value { color: var(--primary); margin-top: 4px; }

/* ---------- Profilo ---------- */
.profile-head {
  display: flex; align-items: center; gap: 14px; padding: 4px 16px 14px;
}
.profile-avatar {
  width: 64px; height: 64px; flex: none; border-radius: 50%;
  border: none; cursor: pointer;
  background: var(--primary); color: #fff;
  font-size: 26px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.profile-name { font-size: 20px; font-weight: 700; }
.profile-head .link-btn { font-size: 14px; margin-top: 2px; }
.dashboard-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
  padding: 0 16px 14px;
}
.dash-tile {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-size: 15px; font-weight: 600;
  cursor: pointer; text-align: left;
}
.dash-tile:active { background: var(--surface-2); }
.dash-icon {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: var(--surface-2); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Programmi ---------- */
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin: 20px 16px 10px;
}
.section-head h2 { margin: 0; font-size: 19px; }
.section-head .link-btn { font-size: 14px; color: var(--primary); white-space: nowrap; }
.program-grid {
  display: grid; grid-template-columns: 1fr; gap: 10px; padding: 0 16px 24px;
}
.program-card {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; color: var(--text); text-align: left; cursor: pointer;
}
.program-card:active { background: var(--surface-2); }
.program-card-body { flex: 1; min-width: 0; }
.program-card-title { font-size: 15px; font-weight: 600; line-height: 1.25; }
.program-card-sub { font-size: 13px; color: var(--text-3); margin-top: 4px; }
.program-card-badge {
  display: inline-block; margin-top: 6px; padding: 2px 8px; border-radius: 999px;
  background: rgba(0, 140, 255, 0.15); color: var(--primary); font-size: 11px; font-weight: 700;
}
.program-cover {
  width: 108px; height: 108px; flex: none; border-radius: 12px; background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  overflow: hidden; position: relative;
}
.program-cover.compact { width: 74px; height: 74px; border-radius: 10px; }
.program-cover-label {
  color: #008CFF; font-weight: 800; font-size: 13px; line-height: 1.05;
  text-align: center; text-transform: uppercase; letter-spacing: -0.2px; padding: 0 4px;
  max-width: 100%; word-break: break-word;
}
.program-cover.compact .program-cover-label { font-size: 10px; }
.program-cover-art { display: flex; }
.program-rail {
  display: flex; gap: 10px; overflow-x: auto; padding: 0 16px 6px; scroll-snap-type: x mandatory;
}
.program-rail-card {
  flex: none; width: 148px; padding: 10px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px; color: var(--text);
  text-align: left; cursor: pointer; scroll-snap-align: start;
}
.program-rail-card .program-cover { width: 100%; height: 86px; }
.program-rail-card .program-card-title { margin-top: 8px; font-size: 14px; }
.program-hero { padding: 8px 16px 0; }
.program-hero .program-cover { width: 132px; height: 132px; }
.program-author { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.program-author-badge {
  width: 22px; height: 22px; border-radius: 50%; background: #111; color: #fff;
  font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.program-desc { padding: 0 16px; color: var(--text-2); line-height: 1.5; margin: 4px 0 14px; }
.program-meta {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px 10px; padding: 0 16px 8px;
}
.program-meta-row { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); }
.program-routine {
  margin: 0 16px 12px; padding: 14px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px;
}
.program-routine-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.program-routine .title { font-size: 16px; font-weight: 700; }
.program-ex-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.program-ex { font-size: 13px; color: var(--text-3); }
.program-progress { margin: 0 16px 12px; }
.program-progress-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.progress-track { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--primary); }
.program-active-card {
  display: flex; align-items: center; gap: 10px; width: calc(100% - 32px);
  margin: 0 16px 12px; text-align: left; cursor: pointer;
}
.program-next-card { margin: 0 16px 12px; }
.program-next-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.program-next-card .title { font-size: 16px; font-weight: 700; margin-top: 4px; }
.cat-icon, .trainer-row-icon {
  width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; color: var(--primary); flex: none;
}
.trainer-row .title { font-size: 15px; font-weight: 600; }

/* ---------- Trainer ---------- */
.trainer-hero, .trainer-teaser { padding: 4px 16px 8px; }
.trainer-title { font-size: 30px; color: var(--primary); text-align: center; margin: 8px 0 10px; }
.trainer-teaser .trainer-title { font-size: 26px; }
.trainer-sub { text-align: center; color: var(--text-2); font-size: 15px; line-height: 1.4; margin: 0 0 18px; }
.trainer-bullets { display: flex; flex-direction: column; gap: 14px; margin: 10px 0 4px; }
.trainer-bullet { display: flex; gap: 12px; align-items: flex-start; }
.trainer-bullet .title { font-size: 15px; font-weight: 600; }
.trainer-bullet .muted { font-size: 13px; line-height: 1.35; margin-top: 2px; }
.trainer-check { color: var(--primary); flex: none; margin-top: 2px; }
.trainer-form { padding: 4px 16px 0; }
.chip-row.wrap { flex-wrap: wrap; }
.trainer-teaser { padding-bottom: 20px; }

.selector-row .grow { flex: 1; }
