:root {
  --bg: #0d0d0f;
  --card: #1a1a1d;
  --card-2: #26262a;
  --stroke: rgba(255, 255, 255, 0.08);
  --text: #fff;
  --muted: rgba(255, 255, 255, 0.55);
  --yellow: #DCFB08;          /* giallo fosforescente del logo */
  --yellow-soft: rgba(220, 251, 8, 0.14);
  --on-yellow: #0d0d0f;
  --good: #40d973;
  --bad: #ff5252;
  --body: #2f2f34;            /* colore del corpo nelle figure dei muscoli */
  --radius: 22px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 64px;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
body.overlay-open { overflow: hidden; }
body.overlay-open .tabbar { display: none; }

/* ---------- Layout ---------- */
.view {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(var(--safe-top) + 14px) 16px calc(var(--safe-bottom) + var(--tabbar-h) + 28px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 18px;
  width: 100%;
  text-align: left;
}

.page-head h1 { margin: 0; font-size: 32px; font-weight: 800; letter-spacing: -0.5px; }
.page-head p { margin: 4px 0 0; }

.btn {
  border: 0; border-radius: 14px; padding: 13px 18px;
  font-size: 16px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn.yellow { background: var(--yellow); color: var(--on-yellow); }
.btn.ghost { background: var(--card-2); color: var(--text); }
.btn.outline { background: transparent; color: var(--yellow); box-shadow: inset 0 0 0 2px var(--yellow); }
.btn.big { padding: 18px; font-size: 18px; border-radius: 18px; width: 100%; }
.btn:active, .tile:active, .day:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.35; }

/* ---------- Barra in basso ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(3, 1fr);
  max-width: 520px; margin: 0 auto;
  padding: 6px 12px calc(var(--safe-bottom) + 6px);
  background: rgba(13, 13, 15, 0.88);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--stroke);
}
.tabbar button {
  background: none; border: 0; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 0; font-size: 11px; font-weight: 600;
}
.tabbar svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button.active { color: var(--yellow); }

/* ---------- HOME ---------- */
.brand { display: flex; align-items: center; justify-content: space-between; }
.logo { height: 30px; display: block; }

.today .eyebrow { margin: 0; font-size: 13px; font-weight: 800; letter-spacing: 2px; color: var(--yellow); }
.today h1 { margin: 2px 0 0; font-size: 38px; font-weight: 800; letter-spacing: -0.8px; }
.today h1 span { color: var(--muted); font-weight: 600; font-size: 22px; letter-spacing: 0; }
.today-status { margin: 6px 0 0; font-size: 17px; color: rgba(255, 255, 255, 0.85); }
.today-status strong { color: var(--yellow); }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  aspect-ratio: 1; border-radius: 26px; border: 1px solid var(--stroke);
  background: var(--card); padding: 16px; text-align: left;
  display: flex; flex-direction: column; justify-content: space-between;
}
.tile.primary { background: var(--yellow); color: var(--on-yellow); border: 0; }
.tile-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--yellow-soft); }
.tile.primary .tile-icon { background: rgba(0, 0, 0, 0.12); }
.tile-icon svg { width: 26px; height: 26px; fill: none; stroke: var(--yellow); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.tile-icon svg.filled { fill: var(--yellow); stroke: none; }
.tile.primary .tile-icon svg { stroke: var(--on-yellow); }
.tile strong { font-size: 19px; line-height: 1.15; display: block; }
.tile small { font-size: 13px; opacity: 0.7; display: block; margin-top: 4px; }
.tile .mini-bar { height: 6px; border-radius: 9px; background: rgba(0, 0, 0, 0.15); margin-top: 8px; overflow: hidden; }
.tile .mini-bar span { display: block; height: 100%; background: var(--on-yellow); border-radius: 9px; }

.section-label { margin: 6px 0 -6px; font-size: 13px; font-weight: 700; letter-spacing: 1px; color: var(--muted); }

/* Settimana */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day {
  border: 0; background: var(--card); border-radius: 16px;
  padding: 10px 0 8px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  transition: background 0.2s;
}
.day .label { font-size: 11px; font-weight: 600; color: var(--muted); }
.day .num { font-size: 21px; font-weight: 700; }
.day .dot { width: 5px; height: 5px; border-radius: 50%; }
.day.today .dot { background: var(--yellow); }
.day.selected { background: var(--yellow); color: var(--on-yellow); }
.day.selected .label { color: var(--on-yellow); opacity: 0.7; }
.day.selected.today .dot { background: var(--on-yellow); }

/* Calorie */
.calories { cursor: pointer; display: flex; flex-direction: column; gap: 14px; }
.cal-row { display: flex; justify-content: space-between; align-items: flex-end; }
.cal-col { display: flex; flex-direction: column; gap: 2px; }
.cal-col.right { align-items: flex-end; }
.cal-title { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.3px; }
.cal-value { font-size: 36px; font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; }
.cal-value small { font-size: 15px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.cal-value.dim { color: var(--muted); }
.bar { height: 10px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; transition: width 0.5s ease; }
.status { font-size: 13px; font-weight: 600; display: flex; gap: 6px; margin: 0; }
.good { color: var(--good); } .bad { color: var(--bad); } .neutral { color: var(--muted); }
.pill { font-size: 13px; font-weight: 700; color: var(--on-yellow); background: var(--yellow); padding: 8px 12px; border-radius: 99px; }

/* ---------- Esercizi e figure muscoli ---------- */
.body-fig { width: 30px; height: 60px; display: block; }
.body-fig .base, .body-fig g { fill: var(--body); }
.body-fig g.hot { fill: var(--yellow); filter: drop-shadow(0 0 3px rgba(220, 251, 8, 0.6)); }
.muscle {
  flex: none; width: 46px; height: 64px; border-radius: 12px;
  background: #121214; display: grid; place-items: center;
}

.ex-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ex { display: flex; align-items: center; gap: 12px; }
.ex-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.ex-name { font-weight: 600; font-size: 16px; }
.ex-meta { font-size: 13px; color: var(--muted); }
.ex-meta b { color: var(--yellow); font-weight: 700; }

/* ---------- TABELLA ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 10px; padding: 30px 10px 10px;
}
.empty .big-icon { width: 96px; height: 96px; border-radius: 30px; background: var(--yellow-soft); display: grid; place-items: center; margin-bottom: 6px; }
.empty .big-icon svg { width: 52px; height: 52px; fill: none; stroke: var(--yellow); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.empty h2 { margin: 0; font-size: 24px; }
.empty p { margin: 0 0 12px; color: var(--muted); max-width: 300px; }
.empty .stack { width: 100%; display: flex; flex-direction: column; gap: 10px; }

.plan-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.plan-actions .btn { padding: 11px 6px; font-size: 15px; }

.plan-day {
  border-radius: var(--radius); background: var(--card);
  border: 1px solid var(--stroke); border-left: 5px solid var(--yellow);
  padding: 16px;
}
.plan-day.rest { border-left-color: var(--card-2); }
.plan-day header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.plan-day.rest header { margin-bottom: 0; }
.plan-day .dname { font-size: 13px; font-weight: 800; letter-spacing: 1.5px; color: var(--yellow); }
.plan-day.rest .dname { color: var(--muted); }
.plan-day h3 { margin: 2px 0 0; font-size: 20px; }
.plan-day .count { font-size: 13px; color: var(--muted); }

/* ---------- ALLENAMENTO ---------- */
.strip { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.strip .day { flex: none; width: 58px; }
.strip .day.rest .num { color: var(--muted); }

.workout-head { display: flex; justify-content: space-between; align-items: flex-end; }
.workout-head h2 { margin: 0; font-size: 26px; }
.workout-head .counter { font-size: 15px; font-weight: 700; color: var(--yellow); }
.progress { height: 8px; border-radius: 9px; background: var(--card-2); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--yellow); border-radius: 9px; transition: width 0.3s; box-shadow: 0 0 10px rgba(220, 251, 8, 0.5); }

.train-list .ex {
  background: var(--card); border: 1px solid var(--stroke); border-radius: 18px;
  padding: 10px 14px 10px 10px; transition: background 0.2s, border-color 0.2s;
}
.train-list .ex[data-action] { cursor: pointer; }
.check {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  border: 2.5px solid var(--yellow); display: grid; place-items: center;
}
.check.disabled { border-color: var(--card-2); }
.ex.done { border-color: rgba(220, 251, 8, 0.35); background: rgba(220, 251, 8, 0.06); }
.ex.done .check { background: var(--yellow); }
.ex.done .check::after { content: ""; width: 7px; height: 13px; border: solid var(--on-yellow); border-width: 0 3px 3px 0; transform: translateY(-2px) rotate(45deg); }
.ex.done .ex-name { color: var(--muted); text-decoration: line-through; }
.note { font-size: 13px; color: var(--muted); text-align: center; margin: 0; }
.done-banner { background: var(--yellow); color: var(--on-yellow); border-radius: 18px; padding: 14px; text-align: center; font-weight: 800; }

/* ---------- Schermate a tutto schermo ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 30; background: var(--bg);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.overlay-inner {
  max-width: 520px; margin: 0 auto;
  padding: calc(var(--safe-top) + 10px) 16px calc(var(--safe-bottom) + 24px);
  display: flex; flex-direction: column; gap: 16px; min-height: 100%;
}
.topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 44px; }
.topbar .link { background: none; border: 0; color: var(--yellow); font-size: 17px; padding: 6px 0; text-align: left; }
.topbar .link.right { text-align: right; font-weight: 700; }
.topbar strong { font-size: 17px; }

/* Wizard */
.dots { display: flex; gap: 6px; justify-content: center; }
.dots span { width: 22px; height: 5px; border-radius: 9px; background: var(--card-2); }
.dots span.on { background: var(--yellow); }
.wiz-title { margin: 4px 0 0; font-size: 30px; font-weight: 800; letter-spacing: -0.5px; }
.wiz-sub { margin: -8px 0 0; color: var(--muted); }

.athletes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.athlete {
  border: 2px solid var(--stroke); background: var(--card); border-radius: 22px;
  padding: 14px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
  color: var(--yellow);
}
.athlete:last-child:nth-child(odd) { grid-column: 1 / -1; }
.athlete .character { width: 86px; height: 86px; }
.athlete strong { color: var(--text); font-size: 17px; }
.athlete span { color: var(--muted); font-size: 12.5px; line-height: 1.3; }
.athlete.selected { border-color: var(--yellow); background: var(--yellow-soft); }

.days-pick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.days-pick button {
  aspect-ratio: 1; border-radius: 20px; border: 2px solid var(--stroke); background: var(--card);
  font-size: 30px; font-weight: 800;
}
.days-pick button.selected { background: var(--yellow); color: var(--on-yellow); border-color: var(--yellow); }
.week-preview { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week-preview span { text-align: center; padding: 8px 0; border-radius: 12px; font-size: 11px; font-weight: 700; background: var(--card); color: var(--muted); }
.week-preview span.on { background: var(--yellow-soft); color: var(--yellow); }

.option {
  border: 2px solid var(--stroke); background: var(--card); border-radius: 20px;
  padding: 16px; text-align: left; display: flex; flex-direction: column; gap: 4px; position: relative;
}
.option strong { font-size: 18px; }
.option span { color: var(--muted); font-size: 14px; }
.option.selected { border-color: var(--yellow); background: var(--yellow-soft); }
.badge { position: absolute; top: 14px; right: 14px; font-size: 11px; font-weight: 800; letter-spacing: 0.5px; background: var(--yellow); color: var(--on-yellow); padding: 4px 8px; border-radius: 99px; }
.spacer-grow { flex: 1; }

.summary { display: flex; align-items: center; gap: 14px; color: var(--yellow); }
.summary .character { width: 70px; height: 70px; flex: none; }
.summary div { color: var(--text); }
.summary strong { font-size: 20px; display: block; }

/* Editor */
.chips { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.chips button { border: 0; border-radius: 12px; padding: 10px 0; background: var(--card); font-size: 12px; font-weight: 800; position: relative; }
.chips button.has::after { content: ""; position: absolute; bottom: 4px; left: 50%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--yellow); }
.chips button.selected { background: var(--yellow); color: var(--on-yellow); }
.chips button.selected.has::after { background: var(--on-yellow); }

.field {
  width: 100%; background: var(--card); border: 1px solid var(--stroke); border-radius: 14px;
  padding: 12px 14px; font-size: 16px; outline: none;
}
.field:focus { border-color: var(--yellow); }
.ex-edit {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--stroke); border-left: 4px solid var(--yellow);
  border-radius: 18px; padding: 10px;
}
.ex-edit .fields { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ex-edit .fields .field { background: var(--card-2); border: 0; padding: 10px 12px; }
.ex-edit .line { display: flex; gap: 6px; align-items: center; }
.ex-edit .line .field.small { width: 62px; text-align: center; padding: 10px 4px; }
.ex-edit .line select.field { flex: 1; min-width: 0; padding: 10px 8px; }
.ex-edit .x { color: var(--muted); font-weight: 700; }
.icon-btn { flex: none; width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--card-2); display: grid; place-items: center; }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: var(--bad); stroke-width: 2.2; stroke-linecap: round; }
.add-btn { border: 2px dashed rgba(220, 251, 8, 0.4); background: transparent; color: var(--yellow); border-radius: 18px; padding: 14px; font-weight: 700; font-size: 16px; }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; }
.chat-bar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: calc(var(--safe-top) + 10px) 12px 10px; border-bottom: 1px solid var(--stroke);
  width: 100%; max-width: 520px; margin: 0 auto;
}
.back { background: none; border: 0; color: var(--yellow); font-size: 17px; text-align: left; padding: 6px 0; }
.messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 520px; margin: 0 auto; }
.msg { max-width: 80%; padding: 11px 14px; border-radius: 18px; line-height: 1.35; white-space: pre-wrap; word-wrap: break-word; animation: pop 0.25s ease; }
.msg.ai { background: var(--card); align-self: flex-start; border-bottom-left-radius: 6px; }
.msg.me { background: var(--yellow); color: var(--on-yellow); align-self: flex-end; border-bottom-right-radius: 6px; }
.msg.photo { padding: 5px; }
.msg img { display: block; width: 220px; max-width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; }
.msg.typing { color: var(--muted); }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }
.composer {
  display: flex; align-items: flex-end; gap: 10px; width: 100%; max-width: 520px; margin: 0 auto;
  padding: 8px 12px calc(var(--safe-bottom) + 8px); border-top: 1px solid var(--stroke);
}
.round-btn { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--yellow); }
.round-btn svg { width: 22px; height: 22px; fill: var(--on-yellow); }
.round-btn.ghost { background: var(--card); cursor: pointer; }
.round-btn.ghost svg { fill: var(--yellow); }
.round-btn:disabled { opacity: 0.35; }
#draft { flex: 1; resize: none; max-height: 110px; background: var(--card); border: 1px solid var(--stroke); border-radius: 20px; padding: 10px 14px; font-size: 16px; outline: none; }

/* ---------- Fogli dal basso ---------- */
.sheet {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 520px;
  background: var(--card); color: var(--text); border-radius: 24px 24px 0 0;
}
.sheet::backdrop { background: rgba(0, 0, 0, 0.6); }
.sheet[open] { animation: slide 0.25s ease; }
@keyframes slide { from { transform: translateY(100%); } }
.sheet form, .sheet .sheet-body { padding: 10px 20px calc(var(--safe-bottom) + 20px); display: flex; flex-direction: column; gap: 4px; }
.grabber { width: 38px; height: 5px; border-radius: 99px; background: var(--card-2); margin: 0 auto 8px; }
.sheet h2 { margin: 4px 0 10px; font-size: 20px; }
.sheet .sheet-text { margin: -4px 0 12px; color: var(--muted); }
.row { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--stroke); font-size: 17px; }
.switch { appearance: none; -webkit-appearance: none; margin: 0; flex: none; width: 51px; height: 31px; border-radius: 99px; background: var(--card-2); position: relative; cursor: pointer; transition: background 0.2s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.switch:checked { background: var(--yellow); }
.switch:checked::after { transform: translateX(20px); background: var(--on-yellow); }
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper button { width: 36px; height: 32px; border-radius: 10px; border: 0; background: var(--card-2); font-size: 20px; }
.stepper output { min-width: 80px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.stepper output::after { content: " kcal"; font-weight: 500; color: var(--muted); }
.kcal-input { color: var(--muted); }
.kcal-input input { width: 90px; text-align: right; font-weight: 700; color: var(--text); background: var(--card-2); border: 0; border-radius: 10px; padding: 6px 10px; outline: none; -moz-appearance: textfield; }
.kcal-input input::-webkit-outer-spin-button, .kcal-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.hint { font-size: 13px; margin: 10px 0 6px; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }

.choice {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--card-2); border: 0; border-radius: 18px; padding: 14px; margin-bottom: 8px;
}
.choice .ci { flex: none; width: 46px; height: 46px; border-radius: 14px; background: var(--yellow); display: grid; place-items: center; }
.choice .ci svg { width: 24px; height: 24px; fill: none; stroke: var(--on-yellow); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.choice strong { display: block; font-size: 17px; }
.choice small { color: var(--muted); font-size: 13px; }
.ex-edit .line { flex-wrap: wrap; }
.ex-edit .line select.field { flex: 1 1 100%; }
.brand-logo { height: 38px; width: auto; display: block; filter: drop-shadow(0 0 8px rgba(220, 251, 8, 0.3)); }

/* =================== v6: profili, dieta, impostazioni =================== */
.tabbar { grid-template-columns: repeat(5, 1fr); padding-left: 4px; padding-right: 4px; }
.tabbar button { font-size: 10px; }
.tabbar svg { width: 24px; height: 24px; }

.yellow { color: var(--yellow); }
.red { color: var(--bad) !important; }
.small { font-size: 13px; margin: 0; }
.cap { text-transform: capitalize; }
.center { text-align: center; }

/* Avatar */
.avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: none; display: grid; place-items: center; }
.avatar.initials { background: var(--yellow); color: var(--on-yellow); font-weight: 900; font-size: 24px; }
.avatar.sm { width: 38px; height: 38px; font-size: 17px; }
.avatar.xl { width: 104px; height: 104px; font-size: 44px; }
.avatar.add-icon { background: transparent; box-shadow: inset 0 0 0 2px rgba(220, 251, 8, 0.5); }
.avatar.add-icon svg { width: 26px; height: 26px; fill: none; stroke: var(--yellow); stroke-width: 2.4; stroke-linecap: round; }
.avatar-btn { background: none; border: 0; padding: 0; border-radius: 50%; }
.avatar-pick { display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; }
.link-text { color: var(--yellow); font-weight: 600; font-size: 15px; }

/* Schermata profili */
.picker { background: #000; z-index: 40; }
.picker-inner {
  max-width: 520px; margin: 0 auto; min-height: 100%;
  padding: calc(var(--safe-top) + 44px) 20px calc(var(--safe-bottom) + 30px);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.picker-logo { height: 54px; width: auto; display: block; margin: 0 auto; filter: drop-shadow(0 0 14px rgba(220, 251, 8, 0.35)); }
.picker-title { margin: 22px 0 6px; color: var(--muted); font-size: 15px; font-weight: 600; letter-spacing: 0.5px; }
.profile-list {
  width: 100%; display: flex; flex-direction: column; gap: 12px;
  max-height: calc(4 * 84px + 3 * 12px); overflow-y: auto; scrollbar-width: none;
  padding: 2px;
}
.profile-list::-webkit-scrollbar { display: none; }
.profile-card {
  flex: none; height: 84px; width: 100%;
  display: flex; align-items: center; gap: 14px; text-align: left;
  background: #111113; border: 1px solid var(--stroke); border-radius: 22px; padding: 0 16px;
}
.profile-card:active { transform: scale(0.98); background: #18181b; }
.profile-card.add { background: transparent; border: 2px dashed rgba(220, 251, 8, 0.35); }
.pc-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pc-text strong { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-text small { color: var(--muted); font-size: 13px; }
.pc-text small b { color: var(--yellow); }

/* Moduli */
.form-card { background: var(--card); border: 1px solid var(--stroke); border-radius: var(--radius); padding: 0 16px; width: 100%; }
.frow { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 54px; border-bottom: 1px solid var(--stroke); font-size: 16px; }
.frow:last-child { border-bottom: 0; }
.frow > span:first-child { flex: none; }
.frow em { color: var(--yellow); font-style: normal; }
.frow.error > span:first-child { color: var(--bad); }
.finput { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; text-align: right; font-size: 16px; color: var(--text); padding: 12px 0; }
.finput::placeholder { color: rgba(255, 255, 255, 0.3); }
select.finput { appearance: none; -webkit-appearance: none; color: var(--yellow); font-weight: 600; cursor: pointer; text-align-last: right; }
.unit { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.finput.num { width: 80px; flex: none; font-weight: 700; -moz-appearance: textfield; }
.finput.num::-webkit-outer-spin-button, .finput.num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.seg { display: inline-flex; background: var(--card-2); border-radius: 11px; padding: 3px; }
.seg button { border: 0; background: transparent; border-radius: 9px; padding: 7px 14px; font-size: 14px; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--yellow); color: var(--on-yellow); }
.bmi b { color: var(--yellow); }
.text-block { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.text-block > span { font-size: 13px; font-weight: 700; letter-spacing: 0.5px; color: var(--muted); text-transform: uppercase; }
textarea.field { resize: vertical; font-family: inherit; }
.choice.import { margin-bottom: 0; background: var(--card); border: 1px solid var(--stroke); }
.choice.danger .ci { background: var(--bad); }
.btn.danger-outline { background: transparent; color: var(--bad); box-shadow: inset 0 0 0 2px rgba(255, 82, 82, 0.5); width: 100%; }

/* Alimentazione */
.nutri-summary { display: flex; flex-direction: column; gap: 12px; }
.cal-value.yellow { color: var(--yellow); }
.cal-value.red { color: var(--bad); }
.macros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.macro { background: var(--card-2); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.macro span { font-size: 12px; color: var(--muted); font-weight: 600; }
.macro b { font-size: 18px; }
.macro b small { font-size: 12px; color: var(--muted); font-weight: 600; }
.mini-progress { height: 5px; border-radius: 9px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.mini-progress span { display: block; height: 100%; background: var(--yellow); border-radius: 9px; }

.log-group { display: flex; flex-direction: column; gap: 8px; }
.log-title { margin: 4px 0 0; display: flex; justify-content: space-between; font-size: 13px; font-weight: 800; letter-spacing: 1px; color: var(--yellow); text-transform: uppercase; }
.log-title span { color: var(--muted); font-weight: 600; letter-spacing: 0; text-transform: none; }
.log-item { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--stroke); border-radius: 16px; padding: 10px 10px 10px 14px; }
.li-main { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.li-main small { color: var(--muted); font-size: 13px; }

.empty-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.empty-card .big-icon { width: 80px; height: 80px; border-radius: 26px; background: var(--yellow-soft); display: grid; place-items: center; }
.empty-card .big-icon svg { width: 42px; height: 42px; fill: none; stroke: var(--yellow); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.empty-card h2 { margin: 0; font-size: 21px; }
.empty-card p { margin: 0 0 6px; }

.diet-head { display: flex; flex-direction: column; gap: 4px; border-left: 5px solid var(--yellow); }
.diet-head strong { font-size: 18px; }
.plan-actions.two { grid-template-columns: 1fr 1fr; }
.meal-card { background: var(--card); border: 1px solid var(--stroke); border-left: 5px solid var(--yellow); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.meal-card header { display: flex; justify-content: space-between; align-items: baseline; }
.meal-card .dname { font-size: 13px; font-weight: 800; letter-spacing: 1.5px; color: var(--yellow); }
.meal-card h3 { margin: 2px 0 0; font-size: 20px; }
.meal-card .count { font-size: 13px; color: var(--muted); }
.food-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.food-list li { display: flex; justify-content: space-between; gap: 10px; font-size: 15px; }
.food-list li b { color: var(--yellow); font-weight: 700; white-space: nowrap; }
.meal-text { margin: 0; white-space: pre-wrap; color: rgba(255, 255, 255, 0.85); }
.small-btn { padding: 10px; font-size: 14px; }
.eaten { color: var(--yellow); font-weight: 700; font-size: 14px; text-align: center; padding: 6px; }

.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 2px solid var(--stroke); background: var(--card); border-radius: 99px; padding: 9px 14px; font-size: 14px; font-weight: 600; }
.chip.on { background: var(--yellow); color: var(--on-yellow); border-color: var(--yellow); }
.target-card { display: flex; flex-direction: column; gap: 10px; border: 2px solid var(--yellow); }
.big-num { font-size: 48px; font-weight: 900; line-height: 1; color: var(--yellow); }
.big-num small { font-size: 18px; color: var(--muted); margin-left: 6px; }
.option:has(.badge) { padding-top: 40px; }
.badge { top: 12px; left: 16px; right: auto; }
.option .badge { color: #000; font-weight: 900; }

/* =================== v7: AI =================== */
.btn.ai-btn { background: var(--yellow-soft); color: var(--yellow); box-shadow: inset 0 0 0 1.5px rgba(220, 251, 8, 0.45); width: 100%; }
.btn.full { width: 100%; }
.pad { padding: 6px 4px; margin: 0; }
.tag { font-style: normal; font-size: 10px; letter-spacing: 0.5px; background: var(--yellow); color: #000; padding: 2px 6px; border-radius: 6px; margin-left: 6px; vertical-align: 1px; }
.meal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: center; }
.seg.wide { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 10px; }
.seg.wide button { padding: 10px; }
#meal-sheet form { gap: 10px; }
.ai-result { padding: 14px; }
.frow.filled .finput { color: var(--yellow); }

.msg.error { color: var(--bad); }
.msg-card {
  align-self: flex-start; max-width: 85%; display: flex; flex-direction: column; gap: 8px;
  background: var(--card); border: 1.5px solid rgba(220, 251, 8, 0.5); border-radius: 18px; padding: 14px;
  animation: pop 0.25s ease;
}
.msg-card ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.msg-card .btn { padding: 11px; font-size: 15px; }
.msg-card .eaten { text-align: left; padding: 0; }

.sheet-body.loading { align-items: center; text-align: center; padding-bottom: calc(var(--safe-bottom) + 36px); gap: 14px; }
.sheet-body.loading p { margin: 0; font-weight: 600; }
.spinner {
  width: 44px; height: 44px; border-radius: 50%; margin-top: 10px;
  border: 4px solid var(--yellow-soft); border-top-color: var(--yellow);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =================== v8: PIN =================== */
.note.left { text-align: left; padding: 0 4px; }
.pin-sheet { border: 0; padding: 0; margin: auto; width: 100%; max-width: 380px; background: transparent; color: var(--text); }
.pin-sheet::backdrop { background: rgba(0, 0, 0, 0.92); }
.pin-body { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 20px; }
.pin-body h2 { margin: 0; font-size: 24px; }
.pin-body p { margin: 0; min-height: 20px; text-align: center; }
.pin-dots { display: flex; gap: 18px; margin: 18px 0 26px; }
.pin-dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--yellow); }
.pin-dots span.on { background: var(--yellow); }
.pin-dots.shake { animation: shake 0.35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 50% { transform: translateX(8px); } 75% { transform: translateX(-4px); } }
.pin-pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 16px 26px; }
.pin-pad button { width: 76px; height: 76px; border-radius: 50%; border: 0; background: var(--card-2); font-size: 30px; font-weight: 600; }
.pin-pad button:active { background: var(--yellow); color: #000; }
.center-link { margin-top: 14px; text-align: center !important; background: none; border: 0; color: var(--yellow); font-size: 17px; }
.pin-sheet[open] { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; background: #000; display: flex; align-items: center; justify-content: center; }
.pin-sheet::backdrop { background: #000; }

/* =================== v9: catalogo e codici a barre =================== */
.choice .ci svg path[stroke-width] { stroke-width: 1.6; }
.topbar .link.right svg { width: 26px; height: 26px; fill: none; stroke: var(--yellow); stroke-width: 2; }
.field.search { font-size: 17px; padding: 14px 16px; border-radius: 16px; }
.cat-strip { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; }
.cat-strip::-webkit-scrollbar { display: none; }
.cat-strip .chip { flex: none; padding: 8px 13px; font-size: 13px; }
.food-list-box { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--stroke); border-radius: 18px; overflow: hidden; }
.food-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--stroke); padding: 12px 14px; }
.food-row:last-child { border-bottom: 0; }
.food-row:active { background: var(--card-2); }
.food-row img { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; background: #fff; flex: none; }
.fr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.fr-main strong { font-size: 16px; }
.fr-main small { color: var(--muted); font-size: 12.5px; }
.fr-main small em { font-style: normal; opacity: 0.7; }
#food-results { display: flex; flex-direction: column; gap: 10px; }
.small-empty { gap: 8px; }

#portion-sheet form { gap: 12px; }
.portion-head { display: flex; gap: 12px; align-items: flex-start; }
.portion-head img { width: 64px; height: 64px; border-radius: 14px; object-fit: contain; background: #fff; flex: none; }
.portion-head h2 { margin: 0 0 2px; font-size: 20px; }
.portion-head p { margin: 2px 0 0; }
.portion-total { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 8px; background: var(--yellow-soft); border: 1.5px solid rgba(220, 251, 8, 0.4); border-radius: 18px; padding: 14px 16px; }
.portion-total > b { font-size: 36px; font-weight: 900; color: var(--yellow); line-height: 1; }
.portion-total > span { color: var(--muted); font-weight: 600; }
.pt-macros { width: 100%; display: flex; gap: 16px; font-size: 14px; color: var(--muted); }
.pt-macros b { color: var(--text); }

.scan-box { position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: 22px; overflow: hidden; background: #000; border: 1px solid var(--stroke); }
.scan-box video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; left: 12%; right: 12%; top: 30%; bottom: 30%; border: 3px solid var(--yellow); border-radius: 16px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35); }
.scan-frame::after { content: ""; position: absolute; left: 6%; right: 6%; top: 50%; height: 2px; background: var(--yellow); box-shadow: 0 0 12px var(--yellow); animation: scanline 1.6s ease-in-out infinite; }
@keyframes scanline { 0%, 100% { transform: translateY(-28px); } 50% { transform: translateY(28px); } }
label.btn { cursor: pointer; }
label.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }

/* =================== v10: modifiche solo per oggi =================== */
.scope-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tag.today { background: #fff; }
.today-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--yellow-soft); border: 1.5px solid rgba(220, 251, 8, 0.4); border-radius: 16px; padding: 10px 14px; font-size: 14px; font-weight: 600; color: var(--yellow); }
.today-banner .link { background: none; border: 0; color: var(--text); font-weight: 700; text-decoration: underline; }

/* =================== v11: niente zoom col doppio tocco =================== */
/* "manipulation" lascia scorrere la pagina ma disattiva lo zoom col doppio tocco su iPhone */
html, body, *, *::before, *::after { touch-action: manipulation; }
/* Safari ingrandisce i campi con testo più piccolo di 16px quando li tocchi: li teniamo a 16px */
input, select, textarea { font-size: max(16px, 1em); }

/* =================== v12: giorni a scelta e Hybrid pesi/corsa =================== */
.weekday-pick { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.weekday-pick button { border: 2px solid var(--stroke); background: var(--card); border-radius: 14px; padding: 12px 0 8px; font-size: 13px; font-weight: 800; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.weekday-pick button small { font-size: 8.5px; font-weight: 600; color: var(--muted); letter-spacing: 0.2px; }
.weekday-pick button.on { background: var(--yellow); color: var(--on-yellow); border-color: var(--yellow); }
.weekday-pick button.on small { color: rgba(0, 0, 0, 0.6); }
.mix-list { display: flex; flex-direction: column; gap: 10px; }
.mix-day { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; background: var(--card); border: 2px solid var(--stroke); border-radius: 18px; padding: 12px 14px; text-align: left; }
.mix-day .md-name { font-size: 17px; font-weight: 700; }
.mix-day .seg span { border-radius: 9px; padding: 7px 12px; font-size: 14px; font-weight: 700; color: var(--muted); }
.mix-day .seg span.on { background: var(--yellow); color: var(--on-yellow); }
.mix-day.run { border-color: rgba(220, 251, 8, 0.45); }
.weekday-pick button { min-width: 0; overflow: hidden; }
.weekday-pick button small { font-size: 9px; }
.overlay-inner { overflow-x: hidden; }
.weekday-pick button.on small { font-size: 12px; font-weight: 900; color: #000; }

/* =================== v13: home calorie a 3 colonne =================== */
.cal-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; align-items: end; }
.cal-3 .cal-col.mid { align-items: center; }
.cal-3 .cal-value { font-size: 26px; }
.cal-3 .cal-value small { font-size: 12px; margin-left: 2px; }
.cal-3 .cal-title { font-size: 10.5px; }
.cal-bars { display: flex; flex-direction: column; gap: 8px; }
.cal-bar-row { display: flex; flex-direction: column; gap: 4px; }
.cal-bar-row > span { font-size: 12px; color: var(--muted); font-weight: 600; }
.cal-bar-row > span b { color: var(--text); }
.cal-bar-row .bar { height: 8px; }

/* =================== v14: dettaglio calorie con fonte =================== */
.est-items { list-style: none; margin: 0; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; background: var(--card-2); border-radius: 14px; }
.est-items li { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; font-size: 14px; }
.est-items li em { font-style: normal; color: var(--muted); }
.est-items li b { color: var(--yellow); }
.est-items .src { grid-column: 1 / -1; font-size: 11px; color: var(--good); font-weight: 600; }
.est-items .src.guess { color: var(--muted); }
.ai-result .est-items { background: transparent; padding: 0; }

/* =================== v16: fix riquadro allenamento =================== */
.tile { aspect-ratio: auto; min-height: 172px; gap: 14px; }
.tile .mini-bar { display: block; width: 100%; }
.tile > span:last-child { display: block; width: 100%; }

/* =================== v16: scheda tecnica esercizi =================== */
.info-btn {
  flex: none; width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid rgba(220, 251, 8, 0.5);
  background: transparent; color: var(--yellow); font-weight: 800; font-style: italic; font-family: Georgia, serif; font-size: 16px;
  display: grid; place-items: center; padding: 0;
}
.info-btn:active { background: var(--yellow); color: #000; }
#info-sheet { max-height: 88dvh; overflow-y: auto; }
.sheet-body.info { gap: 14px; }
.info-head { display: flex; gap: 14px; align-items: center; }
.info-head h2 { margin: 0 0 2px; font-size: 22px; }
.info-head p { margin: 0; }
.muscle.big { width: 64px; height: 92px; }
.muscle.big .body-fig { width: 42px; height: 84px; }
.tip-sec { background: var(--card-2); border-radius: 16px; padding: 12px 14px; }
.tip-sec h3 { margin: 0 0 8px; font-size: 13px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--yellow); }
.tip-sec.mistakes h3 { color: var(--bad); }
.tip-sec ul, .tip-sec ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; line-height: 1.35; }
.sheet-body.info .loading { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px 0 30px; }

/* =================== v17: +, taccuino, cambia esercizio =================== */
.workout-block { display: flex; flex-direction: column; gap: 12px; }
.workout-block.extra { border-top: 1px dashed var(--stroke); padding-top: 16px; }
.wh-right { display: flex; align-items: center; gap: 10px; }
.round-mini { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--yellow); display: grid; place-items: center; flex: none; padding: 0; }
.round-mini svg { width: 22px; height: 22px; fill: none; stroke: #000; stroke-width: 2.6; stroke-linecap: round; }
.round-mini.ghost { background: var(--card-2); }
.round-mini.ghost svg { stroke: var(--bad); width: 18px; height: 18px; stroke-width: 2.2; }
.rest-block .workout-head h2 { font-size: 22px; }

.ex-tools { display: flex; align-items: center; gap: 6px; flex: none; }
.tool-btn { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--stroke); background: transparent; display: grid; place-items: center; padding: 0; }
.tool-btn svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tool-btn.on { border-color: var(--yellow); background: var(--yellow-soft); }
.tool-btn.on svg { stroke: var(--yellow); }
.tool-btn:active { background: var(--yellow); }
.train-list .ex { padding-right: 10px; gap: 10px; }
.train-list .muscle { width: 40px; height: 58px; }

/* taccuino */
#log-sheet, #swap-sheet { max-height: 90dvh; overflow-y: auto; }
#log-sheet form { gap: 12px; }
.last-time { margin: 0; font-size: 13px; color: var(--yellow); background: var(--yellow-soft); border-radius: 12px; padding: 8px 12px; }
.sets { display: flex; flex-direction: column; gap: 8px; }
.set-row { display: grid; grid-template-columns: 28px 1fr auto 1fr; gap: 8px; align-items: center; }
.set-n { width: 28px; height: 28px; border-radius: 50%; background: var(--card-2); display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.set-field { display: flex; align-items: center; gap: 6px; background: var(--card-2); border-radius: 12px; padding: 0 12px; }
.set-field input { width: 100%; min-width: 0; background: transparent; border: 0; outline: none; color: var(--text); font-weight: 700; padding: 12px 0; text-align: right; -moz-appearance: textfield; }
.set-field input::-webkit-outer-spin-button, .set-field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.set-field span { color: var(--muted); font-size: 13px; }
.set-row .x { color: var(--muted); font-weight: 700; }
.rpe { display: flex; justify-content: space-between; gap: 6px; }
.rpe-ico { position: relative; width: 56px; height: 56px; }
.rpe-ico svg { width: 56px; height: 56px; }
.rpe-base svg { fill: var(--card-2); }
.rpe-top { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--fill)) 0 0); }
.rpe-top svg { fill: var(--yellow); filter: drop-shadow(0 0 6px rgba(220, 251, 8, 0.5)); }
.rpe-half { position: absolute; top: 0; bottom: 0; width: 50%; background: transparent; border: 0; padding: 0; }
.rpe-half.l { left: 0; } .rpe-half.r { right: 0; }
.rpe-label { margin: -4px 0 0; text-align: center; font-weight: 700; color: var(--yellow); font-size: 15px; }

/* cambia esercizio */
.swap-search { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.swap-search .btn { padding: 0 16px; }
.alt-list { display: flex; flex-direction: column; gap: 8px; }
.alt-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--card-2); border: 2px solid transparent; border-radius: 16px; padding: 10px 12px; }
.alt-item.selected { border-color: var(--yellow); background: var(--yellow-soft); }
.muscle.sm { width: 34px; height: 50px; background: #121214; }
.muscle.sm .body-fig { width: 22px; height: 44px; }
.alt-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.alt-main strong { font-size: 15px; }
.alt-main small { color: var(--muted); font-size: 12.5px; line-height: 1.3; }
.score { flex: none; display: flex; flex-direction: column; align-items: center; min-width: 46px; border-radius: 12px; padding: 6px 4px; }
.score b { font-size: 20px; line-height: 1; }
.score small { font-size: 10px; opacity: 0.7; }
.score.hi { background: rgba(64, 217, 115, 0.15); color: var(--good); }
.score.mid { background: var(--yellow-soft); color: var(--yellow); }
.score.lo { background: rgba(255, 82, 82, 0.15); color: var(--bad); }
.loading-row { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 12px 4px; }
.spinner.sm { width: 22px; height: 22px; border-width: 3px; margin: 0; }

/* =================== v18: aggiungi esercizio =================== */
#addex-sheet { max-height: 90dvh; overflow-y: auto; }
#addex-sheet form { gap: 12px; }
#addex-sheet .cat-strip { margin: 0 -20px; padding: 0 20px 2px; }
.pick-list { display: flex; flex-direction: column; gap: 6px; max-height: 38dvh; overflow-y: auto; }
.pick { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--card-2); border: 2px solid transparent; border-radius: 14px; padding: 8px 12px; font-size: 15px; font-weight: 600; }
.pick.on { border-color: var(--yellow); background: var(--yellow-soft); }
.add-btn.slim { padding: 10px; font-size: 14px; margin-top: 10px; width: 100%; }

/* ===== v19: calorie vere + Garmin / Apple Watch ===== */
.cal-3 .cal-value { font-size: 24px; white-space: nowrap; }
.cal-3 .cal-col { min-width: 0; }
.cal-sub { font-size: 11px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.cal-sync { color: var(--yellow); text-decoration: none; font-size: 15px; font-weight: 800; padding: 0 2px; }
.cal-balance { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.cal-balance b { color: var(--text); }
.cal-balance b.ok { color: var(--good); }
.cal-balance b.ko { color: var(--bad); }
.cal-link { display: block; width: 100%; margin-top: 12px; padding: 10px; border-radius: 12px; border: 1px dashed var(--yellow); background: transparent; color: var(--yellow); font-weight: 700; font-size: 14px; }
.health-card { padding: 14px 16px; }
.hs-status { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.hs-ok { color: var(--good); font-weight: 700; }
.hs-wait { color: var(--yellow); font-weight: 700; }
.hs-intro { font-size: 14px; margin: 0 0 8px; line-height: 1.4; }
.hs-steps { margin: 0 0 12px; padding-left: 20px; font-size: 13.5px; line-height: 1.45; display: flex; flex-direction: column; gap: 6px; }
.hs-label { font-size: 12px; color: var(--muted); margin: 0 0 4px; font-weight: 700; }
.hs-url { display: block; word-break: break-all; font-size: 12px; background: var(--card-2); border-radius: 10px; padding: 10px; user-select: all; -webkit-user-select: all; }
.hs-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.hs-reset { display: block; margin: 10px auto 0; background: none; border: 0; font-size: 13px; }
.meal-card.skipped { opacity: .75; border-style: dashed; }
.meal-card.skipped header { align-items: center; }
.meal-card.skipped p { margin: 4px 0 0; }
.meal-actions { flex-wrap: wrap; }

/* ===== v23: raccoglitore foto + sposta giorni ===== */
.tray-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 16px; }
.tray-ph { position: relative; aspect-ratio: 3/4; border-radius: 12px; overflow: hidden; background: var(--card-2); }
.tray-ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tray-x { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.7); color: #fff; font-size: 18px; line-height: 1; }
.tray-add { aspect-ratio: 3/4; border-radius: 12px; border: 2px dashed var(--yellow); background: transparent; color: var(--yellow); font-size: 30px; font-weight: 800; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.tray-add small { font-size: 12px; }
#tray-read:disabled { opacity: .4; }
.day-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.day-move { background: transparent; border: 1px solid var(--line, #333); color: var(--yellow); border-radius: 999px; font-size: 12px; font-weight: 700; padding: 4px 10px; }

/* ===== v24: Garmin con chiave + bilancio ===== */
.hs-key { width: 100%; margin: 4px 0 10px; box-sizing: border-box; }
.btn.wide { width: 100%; }
.hs-note { font-size: 12px; color: var(--muted); margin: 10px 0 0; line-height: 1.4; }
.hs-err { font-size: 13px; color: var(--bad); margin: 0 0 8px; }
.hs-more { margin-top: 10px; }
.hs-more summary { font-weight: 700; font-size: 14px; cursor: pointer; padding: 2px 0; }
.hs-more[open] summary { margin-bottom: 8px; }
.cal-balance { margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--card-2); }
.cb-row { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; font-size: 15px; }
.cb-row b { font-size: 18px; }
.cb-row b.ok { color: var(--good); } .cb-row b.ko { color: var(--bad); }
.cb-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.cb-left { font-size: 13px; margin-top: 6px; }
.cb-left b { color: var(--yellow); }
.cal-sync.spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hs-link { color: var(--yellow); font-weight: 700; word-break: break-word; }
.hs-key.finput { text-align: left; background: var(--card-2); border: 1px solid var(--line, #333); border-radius: 10px; padding: 12px; font-size: 15px; }
.cal-3 .cal-col.right { align-items: flex-end; text-align: right; }
.hs-raw { margin: 0 0 10px; font-size: 13px; }
.hs-raw summary { color: var(--muted); cursor: pointer; }
.hs-raw code { display: block; font-size: 11px; color: var(--muted); background: var(--card-2); padding: 8px; border-radius: 8px; }

/* ===== v27: pasti già fatti + scelta del pasto ===== */
.slot-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.slot-chips .chip { border: 1px solid var(--line, #3a3a3a); background: transparent; color: var(--text); border-radius: 999px; padding: 6px 11px; font-size: 13px; font-weight: 600; }
.slot-chips .chip.on { background: var(--yellow); color: #000; border-color: var(--yellow); }
.meal-card.done { border-color: color-mix(in srgb, var(--good) 50%, transparent); }
.tag.ok { background: var(--good); color: #000; }
.done-diff { font-size: 13px; margin: 6px 0 0; color: var(--muted); }
.done-diff.up { color: var(--bad); }
.done-diff.down { color: var(--good); }
.today-banner.adapt { border-color: var(--good); }

/* ===== v28: chiedi ad Amorfo di cambiare un pasto ===== */
.tweak-box { margin: 12px 0; padding: 12px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--yellow) 45%, transparent); background: color-mix(in srgb, var(--yellow) 6%, transparent); }
.tweak-title { margin: 0 0 8px; font-weight: 700; color: var(--yellow); font-size: 14px; }
.tweak-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tweak-chips .chip { border: 1px solid var(--line, #3a3a3a); background: transparent; color: var(--text); border-radius: 999px; padding: 6px 11px; font-size: 13px; font-weight: 600; }
.tweak-row { display: flex; gap: 8px; align-items: center; }
.tweak-input { flex: 1; min-width: 0; background: var(--card-2); border: 1px solid var(--line, #333); color: var(--text); border-radius: 999px; padding: 11px 14px; font-size: 16px; }
.tweak-cam, .tweak-send { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; display: grid; place-items: center; }
.tweak-cam { background: var(--card-2); color: #fff; }
.tweak-cam svg { width: 20px; height: 20px; }
.tweak-send { background: var(--yellow); color: #000; font-size: 20px; font-weight: 800; }
.tweak-send:disabled { opacity: .4; }
.tweak-photo-ok { margin: 8px 0 0; color: var(--good); }
.tweak-result { margin-top: 10px; font-size: 14px; }
.tweak-result p { margin: 0 0 6px; }
.tweak-sum .up { color: var(--good); } .tweak-sum .down { color: var(--muted); }
.tweak-cam svg { stroke: currentColor; fill: none; }

/* ===== v29: contenitori per le griglie ===== */
.meal-grid, .plan-grid { display: flex; flex-direction: column; gap: 16px; }

/* =====================================================================
   COMPUTER E TABLET IN ORIZZONTALE (da 900px): barra a sinistra, contenuti più larghi.
   Sul telefono non cambia niente.
   ===================================================================== */
@media (min-width: 900px) {
  :root { --side-w: 232px; }
  body { padding-left: var(--side-w); }

  /* barra laterale */
  .tabbar {
    top: 0; bottom: 0; left: 0; right: auto; width: var(--side-w); max-width: none; margin: 0;
    display: flex; flex-direction: column; align-items: stretch; gap: 4px;
    padding: 28px 14px; border-top: 0; border-right: 1px solid var(--stroke); background: var(--bg);
  }
  .tabbar::before { content: ''; display: block; height: 52px; margin: 0 10px 26px; background: url(/brand.png) left center / contain no-repeat; }
  .tabbar button { flex-direction: row; justify-content: flex-start; gap: 14px; padding: 12px 14px; border-radius: 12px; font-size: 15px; font-weight: 600; }
  .tabbar button span { font-size: 15px; }
  .tabbar button:hover { background: var(--card); }
  .tabbar button.active { background: var(--card-2); }
  .tabbar svg { width: 22px; height: 22px; }
  body.overlay-open .tabbar { display: flex; pointer-events: none; opacity: 0.45; }

  /* contenuti */
  .view { max-width: 1040px; padding: 40px 40px 56px; gap: 20px; }
  .page-head h1 { font-size: 38px; }
  .brand .brand-logo { visibility: hidden; } /* il logo è già nella barra laterale */
  .tiles { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .cal-3 .cal-value { font-size: 34px; }
  .cal-title { font-size: 13px; }
  .cal-sub { font-size: 13px; }
  .cb-row b { font-size: 22px; }
  .meal-grid, .plan-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
  .plan-actions { max-width: 560px; }
  button, .chip, .day { cursor: pointer; }

  /* schermate a tutto schermo: restano a destra della barra */
  .overlay { left: var(--side-w); }
  .overlay.picker { left: 0; z-index: 40; }
  .overlay-inner { max-width: 760px; padding: 32px 32px 48px; }
  .messages, .chat-bar, .composer { max-width: 760px; }

  /* fogli: al centro come finestre */
  .sheet { margin: auto; border-radius: 24px; max-width: 560px; max-height: 88vh; overflow-y: auto; }
  .sheet[open] { animation: fadein 0.18s ease; }
  .sheet form, .sheet .sheet-body { padding-bottom: 24px; }
}
@media (min-width: 1400px) {
  .meal-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .plan-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@keyframes fadein { from { opacity: 0; transform: scale(0.97); } }

/* ===== v30: account ===== */
.picker-login { display: block; margin: 22px auto 0; background: none; border: 0; color: var(--muted); font-size: 15px; text-align: center; }
.picker-login b { color: var(--yellow); }
.acct-card { padding: 14px 16px; }
.acct-intro { margin: 0 0 12px; font-size: 14px; line-height: 1.45; }
.acct-email { margin: 0 0 4px; font-weight: 800; font-size: 17px; word-break: break-all; }
.acct-form .finput { text-align: right; }
.acct-alt { display: block; margin: 10px auto 0; background: none; border: 0; color: var(--muted); font-size: 14px; }
.acct-alt b { color: var(--yellow); }
.recovery-code { display: block; text-align: center; font-size: 26px; font-weight: 800; letter-spacing: 2px; padding: 18px; margin: 6px 0 12px; border-radius: 14px; background: var(--card-2); color: var(--yellow); user-select: all; -webkit-user-select: all; }

/* ===== v31: calcola prima di mangiare ===== */
.check-btn { color: var(--yellow); }
.check-target { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.check-target b { color: var(--text); }
.check-row { margin: 8px 0; }
.check-row .small { flex: 1; }
.check-row .btn { padding: 10px 18px; }
.check-result { margin: 6px 0; }
.ck-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ck { background: var(--card-2); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 2px; text-align: center; }
.ck small { font-size: 11px; color: var(--muted); }
.ck b { font-size: 15px; }
.ck em { font-style: normal; font-size: 12px; font-weight: 700; }
.ck.ok em { color: var(--good); } .ck.low em { color: var(--yellow); } .ck.high em { color: var(--bad); }
.check-tip { margin: 10px 0 6px; font-size: 14px; line-height: 1.4; }
.watch-stale { margin: 10px 0 0; font-size: 13px; color: var(--yellow); line-height: 1.4; }
.danger-link { display: block; margin: 12px auto 0; background: none; border: 0; color: var(--bad); font-weight: 700; font-size: 14px; }

/* ===== v34: foto con commento + modifica grammature in chat ===== */
.chat-attach { display: flex; gap: 10px; align-items: center; padding: 8px 14px 0; max-width: 520px; margin: 0 auto; width: 100%; box-sizing: border-box; }
.chat-attach[hidden] { display: none; }
.attach-ph { position: relative; flex: none; width: 64px; height: 64px; border-radius: 12px; overflow: hidden; border: 2px solid var(--yellow); }
.attach-ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-ph .tray-x { width: 22px; height: 22px; font-size: 15px; top: 2px; right: 2px; }
.log-items { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.log-items li { display: flex; justify-content: space-between; gap: 8px; }
.log-items em { font-style: normal; color: var(--yellow); font-weight: 700; white-space: nowrap; }
.log-edit-btn { align-self: flex-start; }
.log-edit { list-style: none; margin: 6px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.log-edit li { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; align-items: center; font-size: 14px; }
.le-g { display: flex; align-items: center; gap: 4px; color: var(--muted); }
.le-g input { width: 64px; background: var(--card-2); border: 1px solid var(--yellow); color: var(--text); border-radius: 8px; padding: 6px; font-size: 16px; text-align: right; }
.log-edit em { font-style: normal; color: var(--yellow); font-weight: 700; min-width: 64px; text-align: right; }
.le-del { background: none; border: 0; color: var(--bad); font-size: 20px; }
.le-add { display: flex; gap: 6px; }
.le-add input { flex: 1; min-width: 0; background: var(--card-2); border: 1px solid var(--line, #333); color: var(--text); border-radius: 10px; padding: 8px 10px; font-size: 16px; }
.le-add input.err { border-color: var(--bad); }
.le-tot { margin: 8px 0; }
.done-badge { font-style: normal; font-size: 10px; font-weight: 800; background: var(--good); color: #000; border-radius: 6px; padding: 2px 6px; margin-left: 4px; vertical-align: middle; }
.alt-loads { color: var(--yellow) !important; font-weight: 600; margin-top: 2px; }

/* ===== v39: animazioni esercizi disegnate da Amorfo ===== */
.ex-fig { display: block; flex: none; border-radius: 12px; background: var(--card-2); overflow: hidden; }
.ex-fig svg, .ex .ex-fig svg { display: block; width: 100% !important; height: 100% !important; max-width: none; }
.ex-fig.row { width: 56px; height: 52px; }
.ex-fig.big { width: 100%; aspect-ratio: 200 / 184; max-height: 260px; margin: 12px 0; border-radius: 16px; }
.toggle-row input { width: 22px; height: 22px; accent-color: var(--yellow); }
.ex-fig.row svg { width: 56px !important; height: 52px !important; }
.ex-fig.big svg { width: 100% !important; height: 100% !important; aspect-ratio: 200 / 184; }

/* ===== v41: manichino 3D nella scheda ⓘ ===== */
.ex-3d { position: relative; width: 100%; height: 300px; margin: 12px 0; border-radius: 18px; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 30%, #26262b 0%, #141417 70%); }
.ex-3d .ex-fig.big { position: absolute; inset: 0; margin: 0; height: 100%; max-height: none; background: transparent; }
.ex-3d.ready .ex-fig.big { display: none; }
.ex-3d-canvas { position: absolute; inset: 0; }
.ex-3d-canvas canvas { display: block; width: 100% !important; height: 100% !important; cursor: grab; }
.ex-3d-hint { position: absolute; right: 10px; bottom: 8px; font-size: 11px; color: var(--muted); pointer-events: none; }
.ex-3d:not(.ready) .ex-3d-hint { display: none; }
.ex-3d { height: 320px; background: radial-gradient(120% 90% at 50% 25%, #34343b 0%, #1b1b1f 72%); }
.ex-3d-cue { position: absolute; left: 12px; top: 10px; right: 12px; font-weight: 800; font-size: 17px; color: var(--yellow); text-shadow: 0 1px 6px rgba(0,0,0,.7); pointer-events: none; }
.ex-3d-cue.pop { animation: cuepop .35s ease; }
@keyframes cuepop { from { opacity: 0; transform: translateY(-4px); } }
.ex-fig.row, .ex-fig.row svg { width: 62px !important; height: 58px !important; }

/* ===== v45: consenso privacy al primo avvio, sezione privacy ===== */
.consent { background: #000; z-index: 60; overflow-y: auto; }
.consent-inner {
  max-width: 520px; margin: 0 auto; min-height: 100%;
  padding: calc(var(--safe-top) + 40px) 22px calc(var(--safe-bottom) + 30px);
  display: flex; flex-direction: column; gap: 16px;
}
.consent-title { font-size: 24px; font-weight: 800; text-align: center; margin: 8px 0 0; }
.consent-text { background: var(--card, #161619); border-radius: 18px; padding: 16px 18px; color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.consent-text p { margin: 0 0 10px; }
.consent-text p:last-child { margin: 0; }
.consent-text b { color: var(--text, #fff); }
.consent-check { display: flex; gap: 12px; align-items: flex-start; font-size: 14.5px; line-height: 1.45; cursor: pointer; }
.consent-check input { flex: none; width: 22px; height: 22px; margin-top: 1px; accent-color: var(--yellow); }
.consent-check a, .consent-note a { color: var(--yellow); }
.consent-check.small { font-size: 13px; color: var(--muted); margin: 4px 2px 8px; }
.consent-check.small input { width: 18px; height: 18px; }
.consent-note { color: var(--muted); font-size: 12.5px; text-align: center; margin: 0; }
.legal-card .legal-link { color: inherit; text-decoration: none; }
.legal-card .legal-link .chev { color: var(--muted); }
