/* ==========================================================================
   Forma — design system
   Tema scuro, mobile-first, pensato per essere usato in palestra col telefono.
   ========================================================================== */

:root {
  --bg: #0b0c0e;
  --bg-2: #101216;
  --panel: #14161b;
  --panel-2: #191c22;
  --line: #24272f;
  --line-2: #2f333d;
  --text: #e9ebef;
  --muted: #98a0ad;
  --muted-2: #6b7280;
  --accent: #e8365d;
  --accent-2: #ff6b8a;
  --accent-soft: rgba(232, 54, 93, 0.12);
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --info: #60a5fa;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);

  /* Aree sicure dell'iPhone: Dynamic Island in alto, indicatore Home in basso,
     ritaglio laterale in orizzontale. Sono variabili (non env() diretti) così
     si possono simulare nei test di layout. */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Inter, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  /* iOS gonfia i testi in orizzontale se non lo si blocca */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body { min-height: 100vh; }
a { color: var(--accent-2); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .6rem; }
small { color: var(--muted); }

/* ---------------------------------------------------------------- layout */

.app { min-height: 100vh; display: flex; flex-direction: column; }
.boot { min-height: 100vh; display: grid; place-content: center; gap: 18px; justify-items: center; }
.boot-logo { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  padding: 12px calc(16px + var(--safe-r)) 12px calc(16px + var(--safe-l));
  /* installata sulla Home, l'app si estende sotto la barra di stato:
     senza questo riquadro il titolo finisce dietro la Dynamic Island */
  padding-top: calc(12px + var(--safe-t));
  background: rgba(11, 12, 14, 0.86);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar .brand { font-weight: 800; font-size: 1.05rem; letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.topbar .spacer { flex: 1; }
.topbar .who { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-content: center;
  font-size: .72rem; font-weight: 700; color: #fff; flex: none; }

.wrap {
  width: 100%; max-width: 1080px; margin: 0 auto; flex: 1;
  padding: 16px calc(16px + var(--safe-r)) 16px calc(16px + var(--safe-l));
}
.wrap-narrow { max-width: 680px; }
.section { margin-bottom: 26px; }
.section-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head h2 { flex: 1; }
.section-head .sub { font-size: .8rem; color: var(--muted); }

.bottomnav {
  position: sticky; bottom: 0; z-index: 40;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: rgba(11, 12, 14, 0.92);
  backdrop-filter: saturate(160%) blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
  padding-left: var(--safe-l);
  padding-right: var(--safe-r);
}
.bottomnav button, .bottomnav a {
  background: none; border: 0; padding: 10px 4px 12px; display: grid; gap: 3px;
  justify-items: center; font-size: .68rem; color: var(--muted-2); cursor: pointer;
  text-decoration: none; min-width: 0;
}
.bottomnav button .ico, .bottomnav a .ico { font-size: 1.15rem; line-height: 1; }
.bottomnav button > span:last-child, .bottomnav a > span:last-child {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bottomnav button.on, .bottomnav a.on { color: var(--accent-2); }

/* ------------------------------------------------------------------ card */

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
}
.card + .card { margin-top: 12px; }
.card-tight { padding: 13px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h3 { flex: 1; }
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.tiny { font-size: .78rem; }
.center { text-align: center; }
.mono { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------- kpi */

.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 13px 14px; }
.kpi .label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2); }
.kpi .value { font-size: 1.55rem; font-weight: 700; letter-spacing: -0.02em; margin-top: 3px; }
.kpi .delta { font-size: .76rem; margin-top: 2px; }
.delta.up { color: var(--ok); } .delta.down { color: var(--bad); } .delta.flat { color: var(--muted); }

/* -------------------------------------------------------------- cliente */

.client-card { display: grid; gap: 10px; cursor: pointer; transition: border-color .15s, transform .1s; }
.client-card:hover { border-color: var(--line-2); }
.client-card:active { transform: scale(.995); }
.client-top { display: flex; align-items: center; gap: 11px; }
.client-top .name { font-weight: 620; }
.client-top .goal { font-size: .76rem; color: var(--muted); }
.client-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.client-meta b { color: var(--text); font-weight: 600; }
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: .72rem; font-weight: 600;
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--muted);
}
.pill.ok { color: var(--ok); border-color: rgba(52, 211, 153, .3); background: rgba(52, 211, 153, .08); }
.pill.warn { color: var(--warn); border-color: rgba(251, 191, 36, .3); background: rgba(251, 191, 36, .08); }
.pill.bad { color: var(--bad); border-color: rgba(248, 113, 113, .3); background: rgba(248, 113, 113, .08); }
.pill.accent { color: var(--accent-2); border-color: rgba(232, 54, 93, .35); background: var(--accent-soft); }
.pill.info { color: var(--info); border-color: rgba(96, 165, 250, .3); background: rgba(96, 165, 250, .08); }

.alert {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px;
  border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--panel-2); cursor: pointer;
}
.alert.bad { border-color: rgba(248, 113, 113, .28); background: rgba(248, 113, 113, .06); }
.alert.warn { border-color: rgba(251, 191, 36, .25); background: rgba(251, 191, 36, .05); }
.alert .txt { flex: 1; font-size: .87rem; }

/* --------------------------------------------------------------- bottoni */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--panel-2); color: var(--text); font-weight: 600; font-size: .9rem;
  cursor: pointer; transition: filter .15s, transform .1s; white-space: nowrap;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); border-color: rgba(248, 113, 113, .3); }
.btn.sm { padding: 6px 11px; font-size: .81rem; border-radius: 10px; }
.btn.lg { padding: 14px 20px; font-size: 1rem; border-radius: 14px; }
.btn.block { width: 100%; }
.btn.icon { padding: 8px; border-radius: 10px; }

/* ---------------------------------------------------------------- form */

.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label { font-size: .78rem; color: var(--muted); font-weight: 600; }
.input, select.input, textarea.input {
  width: 100%; padding: 11px 13px; border-radius: 11px;
  border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text);
  outline: none; transition: border-color .15s;
}
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--muted-2); }
textarea.input { resize: vertical; min-height: 74px; }
.input-lg { font-size: 1.5rem; letter-spacing: .3em; text-align: center; text-transform: uppercase; font-weight: 700; padding: 15px; }
.inline-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }

/* ------------------------------------------------------------- esercizio */

.ex-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ex-media { position: relative; aspect-ratio: 16 / 6.4; background: #000; cursor: pointer; }
.ex-media img, .ex-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.ex-media .play {
  position: absolute; inset: 0; display: grid; place-content: center;
  background: linear-gradient(transparent, rgba(0,0,0,.35)); font-size: 1.7rem; color: #fff; opacity: .92;
}
.ex-media .nome { position: absolute; left: 12px; bottom: 10px; right: 12px;
  font-weight: 650; text-shadow: 0 2px 10px rgba(0,0,0,.8); font-size: .98rem; }
.ex-body { padding: 13px; }
.ex-facts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.set-grid { display: grid; gap: 7px; }
.set-row {
  display: grid; grid-template-columns: 34px 1fr 1fr 1fr auto; gap: 7px; align-items: center;
}
.set-row .idx { font-size: .78rem; color: var(--muted-2); text-align: center; font-weight: 700; }
.set-row .input { padding: 9px 8px; text-align: center; font-weight: 650; }
.set-row.done .input { border-color: rgba(52,211,153,.4); background: rgba(52,211,153,.07); }
.set-row .prev { font-size: .7rem; color: var(--muted-2); text-align: center; }
.set-head { display: grid; grid-template-columns: 34px 1fr 1fr 1fr auto; gap: 7px;
  font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-2); text-align: center; }

/* ---------------------------------------------------------------- timer */

.timer-bar {
  position: fixed; left: 0; right: 0; bottom: calc(58px + var(--safe-b)); z-index: 45;
  margin: 0 12px 8px; padding: 10px 14px; border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow);
}
.timer-bar .t { font-size: 1.3rem; font-weight: 750; font-variant-numeric: tabular-nums; flex: 1; }
.progress-line { height: 4px; background: rgba(255,255,255,.3); border-radius: 4px; overflow: hidden; flex: 1.4; }
.progress-line i { display: block; height: 100%; background: #fff; transition: width .9s linear; }

/* --------------------------------------------------------------- grafici */

.chart-box { width: 100%; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .bar { fill: var(--accent); opacity: .85; }
.chart .bar.hi { fill: var(--accent-2); }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .lbl { fill: var(--muted-2); font-size: 10px; }
.chart .line { fill: none; stroke: var(--accent-2); stroke-width: 2.2; stroke-linejoin: round; }
.chart .dot { fill: var(--accent-2); }
/* il riempimento dell'area arriva dal gradiente inline, con id univoco per grafico */
.chart .area { stroke: none; }
.legend { display: flex; gap: 14px; font-size: .76rem; color: var(--muted); margin-top: 8px; flex-wrap: wrap; }

/* ----------------------------------------------------------------- tab */

.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button {
  background: none; border: 0; padding: 10px 13px; color: var(--muted); cursor: pointer;
  font-weight: 600; font-size: .87rem; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }

/* --------------------------------------------------------------- badge */

.badges { display: flex; gap: 10px; flex-wrap: wrap; }
.badge {
  display: grid; gap: 2px; justify-items: center; padding: 11px 13px; min-width: 92px;
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 13px; text-align: center;
}
.badge.locked { opacity: .32; }
.badge .ico { font-size: 1.4rem; }
.badge .t { font-size: .72rem; font-weight: 650; }

/* ---------------------------------------------------------------- chat */

.chat { display: grid; gap: 9px; }
.bubble { max-width: 82%; padding: 10px 13px; border-radius: 15px; font-size: .9rem; }
.bubble.them { background: var(--panel-2); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.bubble.me { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  margin-left: auto; border-bottom-right-radius: 5px; }
.bubble .when { display: block; font-size: .68rem; opacity: .62; margin-top: 4px; }
.chat-input { display: flex; gap: 9px; margin-top: 12px; }
.chat-input .input { flex: 1; }

/* --------------------------------------------------------------- modal */

.modal-host { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; }
.modal-host[hidden] { display: none; }
.modal-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, .72); backdrop-filter: blur(3px); }
.modal {
  position: relative; background: var(--panel); border: 1px solid var(--line-2);
  border-radius: 18px; box-shadow: var(--shadow); width: min(94vw, 720px);
  max-height: 90vh; overflow: auto;
  padding: 18px calc(18px + var(--safe-r)) calc(18px + var(--safe-b)) calc(18px + var(--safe-l));
}
.modal.wide { width: min(96vw, 960px); }
.modal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.modal-head h3 { flex: 1; }
.modal video { width: 100%; border-radius: 13px; background: #000; display: block; }
.close-x { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 9px;
  width: 32px; height: 32px; display: grid; place-content: center; cursor: pointer; flex: none; }

/* -------------------------------------------------------------- toast */

.toasts {
  position: fixed; left: 0; right: 0; top: calc(12px + var(--safe-t)); z-index: 120;
  display: grid; gap: 8px; justify-items: center; pointer-events: none; padding: 0 12px;
}
.toast {
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 13px;
  padding: 11px 15px; box-shadow: var(--shadow); font-size: .88rem; max-width: 460px;
  animation: pop .22s ease-out;
}
.toast.ok { border-color: rgba(52,211,153,.35); }
.toast.bad { border-color: rgba(248,113,113,.35); }
.toast.pr { border-color: rgba(251,191,36,.5); background: linear-gradient(135deg, #1f1a10, var(--panel)); }
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.97); } }

.spinner { width: 26px; height: 26px; border: 2.5px solid var(--line-2);
  border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; padding: 40px; }

.empty { text-align: center; padding: 32px 16px; color: var(--muted); }
.empty .ico { font-size: 2rem; display: block; margin-bottom: 8px; opacity: .6; }

/* ------------------------------------------------------------ login */

.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(94vw, 400px); text-align: center; }
.login-card .logo { font-size: 2.1rem; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 4px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-card .tag { color: var(--muted); font-size: .88rem; margin-bottom: 26px; }

/* --------------------------------------------------------- dettagli ex */

.block { border-top: 1px solid var(--line); padding-top: 13px; margin-top: 13px; }
.block h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2); margin-bottom: 8px; }
ol.steps, ul.list { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: .89rem; }
ul.list { list-style: none; padding-left: 0; }
ul.list li { padding-left: 18px; position: relative; }
ul.list li::before { content: "•"; position: absolute; left: 4px; color: var(--accent); }
.muscle { display: grid; gap: 4px; margin-bottom: 8px; }
.muscle .top { display: flex; justify-content: space-between; font-size: .82rem; }
.muscle .track { height: 6px; background: var(--line); border-radius: 4px; overflow: hidden; }
.muscle .track i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* --------------------------------------------------------------- mobile */

@media (max-width: 640px) {
  .wrap { padding: 13px calc(13px + var(--safe-r)) 13px calc(13px + var(--safe-l)); }
  .kpi .value { font-size: 1.3rem; }
  h1 { font-size: 1.3rem; }
  .set-row { grid-template-columns: 28px 1fr 1fr 1fr 34px; gap: 5px; }
  .set-head { grid-template-columns: 28px 1fr 1fr 1fr 34px; }
  .modal { width: 100vw; max-height: 92vh; border-radius: 18px 18px 0 0; align-self: end; }
  .modal-host { place-items: end center; }
  .topbar-who span { display: none; }
  .topbar-link { display: none; }

  /* iOS ingrandisce la pagina quando si tocca un campo con testo sotto i 16px.
     In palestra significa uno zoom a ogni serie: qui si evita alla radice. */
  .input, select.input, textarea.input, .set-row .input { font-size: 16px; }
  .set-row .input { padding: 8px 6px; }
  .input-lg { font-size: 1.4rem; }

  /* il pollice non deve finire sotto l'indicatore Home */
  .set-row .btn, .ex-facts .pill { min-height: 38px; }
  .btn { min-height: 40px; }
  .btn.sm { min-height: 32px; }

}

/* ============================================================ notifiche */

.bell { position: relative; font-size: 1.05rem; line-height: 1; }
.bell.has-unread { border-color: rgba(232, 54, 93, .45); background: var(--accent-soft); }
.bell-badge {
  position: absolute; top: -6px; right: -6px; min-width: 17px; height: 17px;
  padding: 0 4px; border-radius: 999px; background: var(--accent); color: #fff;
  font-size: .64rem; font-weight: 700; display: grid; place-content: center;
  border: 2px solid var(--bg);
}

.notif {
  display: flex; gap: 11px; align-items: flex-start; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 13px; background: var(--panel-2);
  cursor: pointer; transition: border-color .15s;
}
.notif:hover { border-color: var(--line-2); }
.notif.unread { background: linear-gradient(90deg, var(--accent-soft), var(--panel-2) 55%); border-color: rgba(232,54,93,.22); }
.notif-ico { font-size: 1.15rem; line-height: 1.3; flex: none; }
.notif-title { font-weight: 620; font-size: .91rem; }
.notif-meta { display: flex; gap: 8px; align-items: center; margin-top: 5px; flex-wrap: wrap; min-width: 0; }
/* Senza min-width:0 un testo lungo come stato push allarga la riga oltre lo schermo. */
.notif-meta > * { min-width: 0; }
.notif-meta .push-status { overflow-wrap: anywhere; }
.dot-unread { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; margin-top: 6px; }

.switches { display: grid; gap: 2px; }
.switch-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 2px;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.switch-row:last-child { border-bottom: 0; }
.switch-label { font-weight: 600; font-size: .9rem; }

/* interruttore: input nascosto + traccia disegnata */
.switch { position: relative; flex: none; width: 46px; height: 27px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch i {
  position: absolute; inset: 0; border-radius: 999px; background: var(--line-2);
  transition: background .18s; pointer-events: none;
}
.switch i::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px;
  border-radius: 50%; background: #fff; transition: transform .18s;
}
.switch input:checked + i { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.switch input:checked + i::after { transform: translateX(19px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.hint {
  font-size: .82rem; color: var(--warn); background: rgba(251, 191, 36, .08);
  border: 1px solid rgba(251, 191, 36, .25); border-radius: 11px; padding: 10px 12px;
  line-height: 1.5;
}

/* codice di accesso mostrato in evidenza */
.code-pill {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1rem; font-weight: 700; letter-spacing: .12em;
  padding: 4px 11px; border-radius: 9px;
  background: var(--accent-soft); border: 1px solid rgba(232, 54, 93, .35);
  color: var(--accent-2);
}

/* ============================================== selettore degli esercizi */

/* Testata e piede restano fissi: si scorre solo l'elenco, così il pulsante
   per confermare è sempre a portata di pollice. */
.picker { display: flex; flex-direction: column; gap: 10px; height: min(72vh, 640px); }
.picker-filtri { flex: none; }
.picker-scroll { flex: 1; overflow-y: auto; min-height: 0; padding-right: 4px; }
.picker-foot {
  flex: none; display: flex; align-items: center; gap: 10px;
  padding-top: 12px; border-top: 1px solid var(--line);
}
.picker-foot .btn { min-width: 132px; }

.picker-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
}

.pick-card {
  border: 1px solid var(--line); border-radius: 13px; overflow: hidden;
  background: var(--panel-2); cursor: pointer;
  transition: border-color .15s, transform .1s;
}
.pick-card:hover { border-color: var(--line-2); }
.pick-card:active { transform: scale(.99); }
.pick-card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* anteprima grande: è il motivo per cui si sceglie l'esercizio */
.pick-media { position: relative; aspect-ratio: 16 / 10; background: #000; }
.pick-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pick-vuoto {
  width: 100%; height: 100%; display: grid; place-content: center;
  color: var(--muted-2); font-size: .78rem; background: var(--panel);
}
.pick-check {
  position: absolute; top: 8px; right: 8px; width: 25px; height: 25px;
  border-radius: 50%; display: grid; place-content: center;
  background: rgba(0, 0, 0, .5); border: 2px solid rgba(255, 255, 255, .55);
  color: transparent; font-size: .78rem; font-weight: 700;
  transition: background .15s, color .15s, border-color .15s;
}
.pick-card.on .pick-check { background: var(--accent); border-color: var(--accent); color: #fff; }
.pick-avviso {
  position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; border-radius: 999px;
  background: rgba(0, 0, 0, .62); color: var(--warn); font-size: .68rem; font-weight: 600;
}
.pick-body { padding: 9px 11px 11px; }
.pick-name { font-weight: 620; font-size: .87rem; line-height: 1.3; }

/* =================================================== piano alimentare */

/* --- lato coach: si scrive direttamente nella scheda --- */

.meal-row {
  padding: 10px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 12px;
}
.meal-row .meal-name {
  flex: 1; min-width: 0; padding: 7px 10px;
  font-weight: 650; font-size: .85rem;
}
.meal-row .meal-text {
  margin-top: 8px; min-height: 70px; font-size: .88rem; line-height: 1.5;
}
.target-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.target-row:last-child { border-bottom: 0; }

/* --- lato cliente: si legge --- */

.meal-read {
  padding: 11px 13px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 12px; font-size: .89rem;
}
.meal-read-name {
  font-weight: 700; font-size: .74rem; text-transform: uppercase;
  letter-spacing: .06em; color: var(--accent-2); margin-bottom: 5px;
}

.diet-day {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.diet-day summary {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; cursor: pointer; font-weight: 620;
  list-style: none;
}
.diet-day summary::-webkit-details-marker { display: none; }
.diet-day summary > span:first-child { flex: 1; }
.diet-day summary::after { content: "▾"; color: var(--muted-2); }
.diet-day[open] summary::after { content: "▴"; }
.diet-day > div { padding: 0 16px 16px; }

.target-grid {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
}
.target-chip {
  padding: 9px 11px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px;
}

/* ============================================ adattamenti per il telefono
   Vanno tenuti in fondo al file: a parità di specificità vince l'ultima
   regola, quindi un adattamento scritto prima delle regole base verrebbe
   ignorato senza alcun avviso. */

@media (max-width: 640px) {
  /* selettore esercizi: due colonne comode invece di una lista fitta */
  .picker { height: min(78vh, 640px); }
  .picker-grid { grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 8px; }
  .pick-body { padding: 7px 9px 9px; }
  .pick-name { font-size: .82rem; }
  .picker-foot { flex-wrap: wrap; }
  .picker-foot .btn { flex: 1; min-width: 0; }
}
