/* LivinFit 2.0 — app clienti. Pensata prima di tutto per il telefono. */

:root {
  --bg: #070907;
  --bg-2: #0c100b;
  --surface: rgba(24, 31, 22, 0.66);
  --surface-solid: #131911;
  --surface-2: #1a2217;
  --surface-3: #222c1e;
  --line: rgba(var(--tint), 0.07);
  --line-strong: rgba(var(--tint), 0.13);
  --text: #f3f6ef;
  --muted: #9aa494;
  --faint: #66705f;
  --lime: #bfe84a;
  --lime-2: #95c11f;
  --lime-ink: #0c1206;
  --lime-glow: rgba(181, 227, 58, 0.45);
  --amber: #f5be4f;
  --red: #ff6b6b;
  --cyan: #5ad1e6;
  --violet: #a78bfa;
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius: 18px;
  --radius-sm: 13px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 74px;
  --tint: 255, 255, 255; /* velature e bordi leggeri */
  --well: 0, 0, 0; /* fondo dei campi */
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(149, 193, 31, 0.16), transparent 60%),
    radial-gradient(80% 50% at 110% 30%, rgba(90, 209, 230, 0.06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; border-radius: 10px; }
.num { font-variant-numeric: tabular-nums; }
.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i-sm { width: 17px; height: 17px; }
.i-lg { width: 28px; height: 28px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; position: relative; }

/* ---------- Pulsanti ---------- */
.btn {
  white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 52px; padding: 0 22px; border-radius: 16px; font-weight: 700; font-size: 16px; letter-spacing: -0.01em;
  transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease), background 0.2s, opacity 0.2s;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.btn-block { width: 100%; }
.btn-xl { height: 58px; border-radius: 18px; font-size: 17px; }
.btn-primary {
  background: linear-gradient(135deg, #d4f75a 0%, var(--lime) 45%, var(--lime-2) 100%);
  color: var(--lime-ink);
  box-shadow: 0 12px 32px -12px var(--lime-glow), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.btn-danger { background: rgba(255, 107, 107, 0.12); color: #ff8b8b; border: 1px solid rgba(255, 107, 107, 0.25); }
.btn-warn { background: linear-gradient(135deg, #ffd27a, var(--amber)); color: #1d1404; box-shadow: 0 12px 30px -14px rgba(245, 190, 79, 0.7); }
.btn-text { height: 44px; color: var(--muted); font-weight: 600; font-size: 15px; }
.btn .spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Accesso ---------- */
.auth { min-height: 100dvh; display: flex; flex-direction: column; padding: calc(var(--safe-top) + 22px) 22px calc(var(--safe-bottom) + 24px); position: relative; overflow: hidden; }
.auth-bg { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.55; animation: float 14s ease-in-out infinite alternate; }
.blob.b1 { width: 340px; height: 340px; background: radial-gradient(circle at 30% 30%, #c8f04f, #6f9a12 60%, transparent 70%); top: -120px; right: -120px; }
.blob.b2 { width: 280px; height: 280px; background: radial-gradient(circle, rgba(90, 209, 230, 0.55), transparent 70%); bottom: 18%; left: -150px; animation-duration: 18s; opacity: 0.35; }
.grid-lines {
  position: absolute; inset: 0; opacity: 0.35;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(90% 60% at 50% 20%, #000 30%, transparent 75%);
}
@keyframes float { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(-30px, 40px, 0) scale(1.12); } }
.auth > *:not(.auth-bg) { position: relative; z-index: 1; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand svg { width: 38px; height: 38px; border-radius: 11px; box-shadow: 0 8px 24px -8px rgba(149, 193, 31, 0.6); }
.wordmark { font-size: 21px; font-weight: 800; letter-spacing: -0.03em; }
.wordmark b { color: var(--lime); font-weight: 800; }
.auth-hero { margin-top: auto; padding-top: 48px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--lime); margin: 0 0 14px; }
.eyebrow::before { content: ""; width: 18px; height: 2px; border-radius: 2px; background: var(--lime); }
.auth h1 { font-size: clamp(38px, 11vw, 48px); line-height: 1.02; letter-spacing: -0.045em; margin: 0 0 14px; font-weight: 820; }
.grad { background: linear-gradient(100deg, #e4ff86, var(--lime) 40%, #7fd36b 80%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth .sub { color: var(--muted); font-size: 16.5px; margin: 0 0 28px; max-width: 34ch; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); padding: 20px; backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%); box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.9); }
.field-label { display: block; font-size: 13.5px; font-weight: 650; color: var(--muted); margin: 0 0 10px; }
.phone-field { display: flex; align-items: center; height: 60px; border-radius: 17px; background: rgba(var(--well), 0.35); border: 1.5px solid var(--line-strong); transition: border-color 0.2s, box-shadow 0.2s; margin-bottom: 14px; }
.phone-field:focus-within { border-color: var(--lime); box-shadow: 0 0 0 4px rgba(191, 232, 74, 0.14); }
.phone-field .prefix { padding: 0 14px 0 18px; font-weight: 700; color: var(--muted); border-right: 1px solid var(--line-strong); height: 28px; display: flex; align-items: center; }
.phone-field input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: none; padding: 0 16px; font-size: 20px; font-weight: 650; letter-spacing: 0.02em; }
.phone-field input::placeholder { color: var(--faint); font-weight: 500; }
.fine { margin: 14px 4px 0; font-size: 13.5px; color: var(--muted); text-align: center; }
.auth-foot { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--faint); font-size: 12.5px; margin-top: 18px; }

.back-link { display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 14px 0 8px; margin-left: -8px; color: var(--muted); font-weight: 600; border-radius: 12px; }
.back-link:active { background: var(--surface-2); }

/* Codice OTP */
.otp-wrap { position: relative; margin: 6px 0 16px; }
.otp-boxes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.otp-box { height: 64px; border-radius: 16px; background: rgba(var(--well), 0.35); border: 1.5px solid var(--line-strong); display: grid; place-items: center; font-size: 28px; font-weight: 750; transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s var(--spring); }
.otp-box.filled { border-color: rgba(191, 232, 74, 0.55); animation: pop 0.25s var(--spring); }
.otp-box.active { border-color: var(--lime); box-shadow: 0 0 0 4px rgba(191, 232, 74, 0.14); }
.otp-box.active:empty::after { content: ""; width: 2px; height: 28px; background: var(--lime); border-radius: 2px; animation: blink 1s steps(1) infinite; }
.otp-wrap.error .otp-box { border-color: var(--red); animation: shake 0.4s; }
.otp-wrap.success .otp-box { border-color: var(--lime); background: rgba(191, 232, 74, 0.12); }
.otp-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px; caret-color: transparent; }
@keyframes pop { 0% { transform: scale(0.9); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.resend { display: flex; justify-content: center; }
.dev-code { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 14px; background: rgba(245, 190, 79, 0.1); border: 1px dashed rgba(245, 190, 79, 0.45); color: #ffd99a; font-size: 13.5px; margin-bottom: 14px; }
.dev-code b { font-size: 17px; letter-spacing: 0.2em; color: #ffe4b5; }
.dev-code button { color: var(--amber); font-weight: 700; padding: 6px 10px; border-radius: 10px; background: rgba(245, 190, 79, 0.14); }

/* Scelta profilo */
.profiles { display: grid; gap: 12px; margin-top: 8px; }
.profile-btn { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); text-align: left; transition: transform 0.15s var(--ease), border-color 0.2s; }
.profile-btn:active { transform: scale(0.98); border-color: var(--lime); }
.profile-btn strong { display: block; font-size: 17px; }
.profile-btn small { color: var(--muted); }
.profile-btn .i { margin-left: auto; color: var(--faint); }

.avatar { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; flex: none; font-weight: 800; font-size: 16px; color: var(--lime-ink); background: linear-gradient(140deg, #e2ff7d, var(--lime-2)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.avatar.alt { background: linear-gradient(140deg, #a6f0ff, #3aa9c2); }

/* ---------- Shell dell'app ---------- */
.shell { min-height: 100dvh; padding: calc(var(--safe-top) + 14px) 18px calc(var(--tabbar-h) + var(--safe-bottom) + 28px); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.hello { display: flex; align-items: center; gap: 12px; min-width: 0; }
.hello small { display: block; color: var(--muted); font-size: 13px; font-weight: 600; }
.hello strong { display: block; font-size: 19px; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.credit-chip { display: flex; align-items: center; gap: 9px; height: 46px; padding: 0 14px 0 7px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); transition: transform 0.15s var(--ease); }
.credit-chip:active { transform: scale(0.96); }
.credit-chip span { font-size: 13px; color: var(--muted); font-weight: 600; line-height: 1.1; text-align: left; }
.credit-chip b { display: block; color: var(--text); font-size: 16px; }
.credit-chip.empty b { color: var(--amber); }
.mini-ring { width: 32px; height: 32px; transform: rotate(-90deg); }
.mini-ring circle { fill: none; stroke-width: 4; }
.mini-ring .track { stroke: rgba(var(--tint), 0.09); }
.mini-ring .bar { stroke: var(--lime); stroke-linecap: round; transition: stroke-dashoffset 0.8s var(--ease); }
.credit-chip.empty .mini-ring .bar { stroke: var(--amber); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin: 0 2px 14px; }
.page-head h1 { margin: 0; font-size: 32px; letter-spacing: -0.04em; line-height: 1; font-weight: 820; }
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: 14.5px; }
.section-title { display: flex; align-items: center; gap: 8px; margin: 28px 2px 12px; font-size: 13px; font-weight: 750; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
.section-title .count { margin-left: auto; font-size: 12px; letter-spacing: 0; text-transform: none; color: var(--faint); }

/* Striscia dei giorni */
.days { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 18px 10px; margin: 0 -18px 8px; scrollbar-width: none; scroll-padding: 18px; }
.days::-webkit-scrollbar { display: none; }
.day {
  flex: none; width: 58px; height: 80px; border-radius: 19px; scroll-snap-align: start;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: var(--surface); border: 1px solid var(--line); position: relative;
  transition: transform 0.2s var(--spring), background 0.2s, border-color 0.2s, color 0.2s;
}
.day:active { transform: scale(0.94); }
.day small { font-size: 11px; font-weight: 750; letter-spacing: 0.08em; color: var(--muted); }
.day strong { font-size: 22px; font-weight: 780; letter-spacing: -0.03em; }
.day .dots { display: flex; gap: 3px; height: 6px; margin-top: 3px; }
.day .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--faint); }
.day .dot.mine { background: var(--lime); box-shadow: 0 0 8px var(--lime-glow); }
.day.empty strong { color: var(--faint); }
.day.today small { color: var(--lime); }
.day.selected { background: linear-gradient(160deg, #dcfb6b, var(--lime) 50%, var(--lime-2)); border-color: transparent; color: var(--lime-ink); box-shadow: 0 14px 30px -14px var(--lime-glow); transform: translateY(-2px); }
.day.selected small, .day.selected strong { color: var(--lime-ink); }
.day.selected .dot { background: rgba(12, 18, 6, 0.35); box-shadow: none; }
.day.selected .dot.mine { background: var(--lime-ink); }

/* Schede lezione */
.lessons { display: grid; gap: 12px; }
.lesson {
  --tone: var(--lime);
  position: relative; display: grid; grid-template-columns: 62px 1fr auto; align-items: center; gap: 14px;
  width: 100%; padding: 16px 14px 16px 18px; border-radius: var(--radius-lg); text-align: left;
  background: var(--surface); border: 1px solid var(--line); overflow: hidden;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: transform 0.18s var(--ease), border-color 0.2s, background 0.2s;
}
.lesson::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0; background: var(--tone); box-shadow: 0 0 16px var(--tone); }
.lesson::after { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 120% at 0% 0%, color-mix(in srgb, var(--tone) 12%, transparent), transparent 55%); pointer-events: none; }
.lesson:active { transform: scale(0.985); }
.lesson.is-booked { border-color: color-mix(in srgb, var(--lime) 40%, transparent); background: linear-gradient(135deg, rgba(191, 232, 74, 0.1), var(--surface) 60%); }
.lesson.is-dim { opacity: 0.55; }
.lesson-time strong { display: block; font-size: 21px; font-weight: 780; letter-spacing: -0.03em; line-height: 1.1; }
.lesson-time span { display: block; color: var(--muted); font-size: 13px; font-weight: 600; margin-top: 2px; }
.lesson-body { min-width: 0; }
.lesson-body h3 { margin: 0 0 3px; font-size: 17px; letter-spacing: -0.02em; font-weight: 720; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lesson-body p { margin: 0; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13.5px; }
.lesson-body p .i { width: 15px; height: 15px; }

.tag { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px; border-radius: 999px; font-size: 13.5px; font-weight: 750; white-space: nowrap; position: relative; z-index: 1; }
.tag .i { width: 15px; height: 15px; stroke-width: 2.6; }
.tag-book { background: linear-gradient(135deg, #d4f75a, var(--lime)); color: var(--lime-ink); box-shadow: 0 8px 20px -10px var(--lime-glow); }
.tag-booked { background: rgba(191, 232, 74, 0.14); color: var(--lime); border: 1px solid rgba(191, 232, 74, 0.35); }
.tag-full { background: rgba(var(--tint), 0.06); color: var(--muted); border: 1px solid var(--line-strong); }
.tag-wait { background: rgba(245, 190, 79, 0.12); color: var(--amber); border: 1px solid rgba(245, 190, 79, 0.35); }
.tag-muted { background: transparent; color: var(--faint); border: 1px solid var(--line); }
.tag-red { background: rgba(255, 107, 107, 0.1); color: #ff9090; border: 1px solid rgba(255, 107, 107, 0.28); }
.tag-cyan { background: rgba(90, 209, 230, 0.1); color: var(--cyan); border: 1px solid rgba(90, 209, 230, 0.3); }

/* Entrate animate */
.enter > * { animation: rise 0.5s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.fade { animation: fade 0.35s var(--ease) both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* Stato vuoto */
.empty-state { text-align: center; padding: 34px 20px 28px; border-radius: var(--radius-lg); border: 1px dashed var(--line-strong); background: rgba(var(--tint), 0.015); }
.empty-state .art { width: 76px; height: 76px; margin: 0 auto 14px; border-radius: 24px; display: grid; place-items: center; background: radial-gradient(circle at 30% 30%, rgba(191, 232, 74, 0.25), rgba(191, 232, 74, 0.04)); color: var(--lime); }
.empty-state h3 { margin: 0 0 6px; font-size: 18px; letter-spacing: -0.02em; }
.empty-state p { margin: 0 auto 16px; color: var(--muted); font-size: 14.5px; max-width: 30ch; }

/* Scheletri di caricamento */
.skeleton { height: 82px; border-radius: var(--radius-lg); background: linear-gradient(100deg, var(--surface-solid) 30%, var(--surface-2) 50%, var(--surface-solid) 70%); background-size: 300% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* Le mie prenotazioni */
.when-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 750; background: rgba(191, 232, 74, 0.12); color: var(--lime); margin-bottom: 8px; }
.when-chip.soon { background: rgba(245, 190, 79, 0.14); color: var(--amber); }
.booking-card { display: block; width: 100%; text-align: left; padding: 16px 16px 16px 18px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); position: relative; overflow: hidden; transition: transform 0.18s var(--ease); }
.booking-card:active { transform: scale(0.985); }
.booking-card::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0; background: var(--tone, var(--lime)); }
.booking-card h3 { margin: 0 0 4px; font-size: 18px; letter-spacing: -0.02em; }
.booking-card .meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 14px; }
.booking-card .meta span { display: inline-flex; align-items: center; gap: 6px; }
.booking-card .meta .i { width: 15px; height: 15px; }
.booking-card .arrow { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.history { border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.history-row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.history-row:last-child { border-bottom: 0; }
.history-row .date { width: 44px; text-align: center; flex: none; }
.history-row .date b { display: block; font-size: 18px; line-height: 1; }
.history-row .date small { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.history-row .what { flex: 1; min-width: 0; }
.history-row .what strong { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-row .what small { color: var(--muted); font-size: 13px; }
.history-row .tag { height: 28px; padding: 0 10px; font-size: 12px; }

/* Pacchetto */
.pack-hero { position: relative; display: grid; place-items: center; padding: 26px 18px 22px; border-radius: var(--radius-xl); background: radial-gradient(100% 80% at 50% 0%, rgba(191, 232, 74, 0.16), transparent 70%), var(--surface); border: 1px solid var(--line); overflow: hidden; }
.ring-wrap { position: relative; width: 200px; height: 200px; }
.ring { width: 200px; height: 200px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 14; }
.ring .track { stroke: rgba(var(--tint), 0.07); }
.ring .bar { stroke: url(#ringGrad); stroke-linecap: round; transition: stroke-dashoffset 1.1s var(--ease); filter: drop-shadow(0 0 10px rgba(191, 232, 74, 0.45)); }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-center strong { font-size: 62px; font-weight: 820; letter-spacing: -0.05em; line-height: 0.95; }
.ring-center span { color: var(--muted); font-size: 14px; font-weight: 600; max-width: 128px; margin: 4px auto 0; line-height: 1.25; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; margin-top: 20px; }
.stat { padding: 12px 8px; border-radius: 16px; background: rgba(var(--well), 0.25); border: 1px solid var(--line); text-align: center; }
.stat b { display: block; font-size: 22px; letter-spacing: -0.03em; }
.stat small { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.alert { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius); margin-top: 14px; font-size: 14.5px; }
.alert .i { margin-top: 1px; }
.alert-warn { background: rgba(245, 190, 79, 0.1); border: 1px solid rgba(245, 190, 79, 0.3); color: #ffd99a; }
.alert-info { background: rgba(90, 209, 230, 0.08); border: 1px solid rgba(90, 209, 230, 0.25); color: #b9eef8; }
.alert-ok { background: rgba(191, 232, 74, 0.09); border: 1px solid rgba(191, 232, 74, 0.28); color: #def7a0; }
.card { padding: 16px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); }
.card + .card { margin-top: 10px; }
.pkg-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.pkg-head strong { font-size: 16px; }
.pkg-head span { color: var(--muted); font-size: 13.5px; white-space: nowrap; }
.bar-track { height: 9px; border-radius: 9px; background: rgba(var(--tint), 0.07); overflow: hidden; display: flex; }
.bar-used { background: linear-gradient(90deg, var(--lime-2), var(--lime)); }
.bar-reserved { background: repeating-linear-gradient(135deg, rgba(191, 232, 74, 0.5) 0 4px, rgba(191, 232, 74, 0.2) 4px 8px); }
.pkg-foot { display: flex; justify-content: space-between; margin-top: 9px; font-size: 13px; color: var(--muted); }
.rules { display: grid; gap: 14px; }
.rule { display: flex; gap: 13px; align-items: flex-start; }
.rule .ico { width: 38px; height: 38px; border-radius: 12px; flex: none; display: grid; place-items: center; background: var(--surface-3); color: var(--lime); }
.rule strong { display: block; font-size: 15px; margin-bottom: 1px; }
.rule p { margin: 0; color: var(--muted); font-size: 14px; }
.account { display: flex; align-items: center; gap: 13px; }
.account strong { display: block; font-size: 16px; }
.account small { color: var(--muted); }
.account-actions { display: grid; gap: 10px; margin-top: 14px; }

/* ---------- Barra di navigazione ---------- */
.tabbar {
  position: fixed; z-index: 20; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-bottom) + 12px);
  width: min(440px, calc(100% - 28px)); height: var(--tabbar-h); border-radius: 26px; padding: 7px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  background: rgba(18, 23, 16, 0.78); border: 1px solid var(--line-strong);
  backdrop-filter: blur(22px) saturate(160%); -webkit-backdrop-filter: blur(22px) saturate(160%);
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.95);
}
.tab-indicator { position: absolute; top: 7px; bottom: 7px; left: 7px; width: calc((100% - 14px - 8px) / 3); border-radius: 20px; background: linear-gradient(160deg, rgba(212, 247, 90, 0.2), rgba(149, 193, 31, 0.12)); border: 1px solid rgba(191, 232, 74, 0.3); transition: transform 0.45s var(--spring); }
.tab { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border-radius: 20px; color: var(--faint); font-size: 11.5px; font-weight: 700; transition: color 0.25s; }
.tab.active { color: var(--lime); }
.tab .badge { position: absolute; top: 8px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--lime); color: var(--lime-ink); font-size: 11px; font-weight: 800; display: grid; place-items: center; }

/* ---------- Foglio dal basso ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade 0.25s var(--ease) both; }
.sheet-backdrop.closing { animation: fade 0.22s var(--ease) reverse both; }
.sheet {
  position: fixed; z-index: 41; left: 50%; bottom: 0; width: min(480px, 100%); max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  transform: translateX(-50%); border-radius: 30px 30px 0 0; padding: 10px 20px calc(var(--safe-bottom) + 22px);
  background: linear-gradient(180deg, #1a2217, #10150e 40%); border: 1px solid var(--line-strong); border-bottom: 0;
  box-shadow: 0 -30px 60px -20px rgba(0, 0, 0, 0.8);
  animation: sheet-in 0.42s var(--spring) both;
}
.sheet.closing { animation: sheet-out 0.24s var(--ease) both; }
.sheet.dragging { animation: none; transition: none; }
@keyframes sheet-in { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
@keyframes sheet-out { from { transform: translate(-50%, var(--drag, 0px)); } to { transform: translate(-50%, 100%); } }
.sheet-handle { width: 44px; height: 5px; border-radius: 5px; background: rgba(var(--tint), 0.18); margin: 0 auto 16px; }
.sheet-tone { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 750; letter-spacing: 0.1em; text-transform: uppercase; color: var(--tone, var(--lime)); }
.sheet-tone::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; box-shadow: 0 0 12px currentColor; }
.sheet h2 { margin: 8px 0 4px; font-size: 30px; letter-spacing: -0.04em; line-height: 1.05; font-weight: 820; }
.sheet .sheet-sub { margin: 0 0 18px; color: var(--muted); font-size: 15.5px; }
.facts { display: grid; grid-template-columns: 1.45fr 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.fact { padding: 12px; border-radius: 16px; background: rgba(var(--well), 0.25); border: 1px solid var(--line); }
.fact small { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 650; margin-bottom: 3px; }
.fact small .i { width: 14px; height: 14px; }
.fact b { display: block; font-size: 16.5px; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet .alert { margin: 0 0 12px; }
.sheet-actions { display: grid; gap: 10px; margin-top: 18px; }
.credit-line { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 14px; margin: 4px 2px 0; }
.credit-line b { color: var(--text); }

/* Conferma riuscita */
.success { text-align: center; padding: 16px 4px 4px; }
.success-ring { width: 104px; height: 104px; margin: 6px auto 18px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle, rgba(191, 232, 74, 0.25), rgba(191, 232, 74, 0.05) 70%); position: relative; }
.success-ring::before { content: ""; position: absolute; inset: -10px; border-radius: 50%; border: 2px solid rgba(191, 232, 74, 0.35); animation: ripple 1.2s var(--ease) both; }
.success-ring svg { width: 58px; height: 58px; }
.success-ring circle { fill: var(--lime); }
.success-ring path { fill: none; stroke: var(--lime-ink); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw 0.5s 0.2s var(--ease) forwards; }
.success.wait .success-ring { background: radial-gradient(circle, rgba(245, 190, 79, 0.25), rgba(245, 190, 79, 0.05) 70%); }
.success.wait .success-ring::before { border-color: rgba(245, 190, 79, 0.35); }
.success.wait .success-ring circle { fill: var(--amber); }
.success h2 { font-size: 30px; }
.success p { color: var(--muted); margin: 0 auto; max-width: 30ch; font-size: 15.5px; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes ripple { from { transform: scale(0.7); opacity: 0; } 60% { opacity: 1; } to { transform: scale(1.15); opacity: 0; } }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.confetti i { position: absolute; left: 50%; top: 50%; width: 7px; height: 12px; border-radius: 2px; background: var(--c); animation: burst 0.9s var(--ease) forwards; transform: translate(-50%, -50%); }
@keyframes burst { to { transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) rotate(var(--r)); opacity: 0; } }

/* ---------- Avvisi ---------- */
.toast-root { position: fixed; z-index: 60; top: calc(var(--safe-top) + 12px); left: 50%; transform: translateX(-50%); width: min(440px, calc(100% - 28px)); display: grid; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-radius: 18px; background: rgba(28, 36, 25, 0.92); border: 1px solid var(--line-strong); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.9); font-size: 14.5px; font-weight: 600; animation: toast-in 0.4s var(--spring) both; }
.toast.out { animation: toast-out 0.25s var(--ease) both; }
.toast .i { color: var(--lime); }
.toast.error .i { color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-16px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px) scale(0.97); } }

.boot { min-height: 100dvh; display: grid; place-items: center; }
.boot svg { width: 56px; height: 56px; border-radius: 16px; animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(0.92); opacity: 0.7; } }

@media (min-width: 560px) {
  #app { padding-top: 12px; }
  .shell { padding-top: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- Installazione sulla schermata Home ---------- */
.install-banner {
  position: fixed; z-index: 30; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 24px); width: min(440px, calc(100% - 28px));
  display: grid; grid-template-columns: 44px 1fr auto auto; align-items: center; gap: 12px; padding: 10px 10px 10px 12px;
  border-radius: 20px; background: rgba(24, 31, 22, 0.94); border: 1px solid rgba(191, 232, 74, 0.35);
  backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%);
  box-shadow: 0 20px 44px -18px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(var(--tint), 0.03);
  animation: install-in 0.5s var(--spring) both;
}
.install-banner.out { animation: install-out 0.25s var(--ease) both; }
.install-banner img { width: 44px; height: 44px; border-radius: 12px; }
.install-banner strong { display: block; font-size: 14.5px; letter-spacing: -0.01em; }
.install-banner small { display: block; color: var(--muted); font-size: 12.5px; }
.install-go { height: 38px; padding: 0 14px; border-radius: 12px; font-weight: 750; font-size: 14px; color: var(--lime-ink); background: linear-gradient(135deg, #d4f75a, var(--lime)); white-space: nowrap; }
.install-close { width: 32px; height: 32px; border-radius: 10px; color: var(--muted); font-size: 22px; line-height: 1; }
@keyframes install-in { from { opacity: 0; transform: translate(-50%, 24px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes install-out { to { opacity: 0; transform: translate(-50%, 16px); } }

.install-layer { position: fixed; inset: 0; z-index: 70; }
.install-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.62); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade 0.25s var(--ease) both; }
.install-sheet {
  position: absolute; left: 50%; bottom: 0; width: min(480px, 100%); transform: translateX(-50%);
  padding: 10px 20px calc(var(--safe-bottom) + 92px); border-radius: 30px 30px 0 0;
  background: linear-gradient(180deg, #1a2217, #10150e 45%); border: 1px solid var(--line-strong); border-bottom: 0;
  animation: sheet-in 0.42s var(--spring) both;
}
.install-layer.closing .install-sheet { animation: sheet-out 0.24s var(--ease) both; }
.install-layer.closing .install-backdrop, .install-layer.closing .install-arrow { animation: fade 0.22s var(--ease) reverse both; }
.install-hero { display: flex; gap: 14px; align-items: center; margin: 4px 0 18px; }
.install-hero img { width: 64px; height: 64px; border-radius: 17px; box-shadow: 0 12px 28px -12px var(--lime-glow); flex: none; }
.install-hero h2 { margin: 0 0 4px; font-size: 24px; letter-spacing: -0.03em; }
.install-hero p { margin: 0; color: var(--muted); font-size: 14.5px; }
.install-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.install-steps li { display: grid; grid-template-columns: 26px 40px 1fr; align-items: center; gap: 10px; padding: 12px; border-radius: 18px; background: rgba(var(--well), 0.25); border: 1px solid var(--line); font-size: 15px; }
.install-steps small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.install-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--lime); color: var(--lime-ink); font-weight: 800; font-size: 13px; }
.install-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-3); color: #8ab4ff; }
.install-hint { margin: 12px 4px 0; color: var(--muted); font-size: 13.5px; }
.install-arrow {
  position: absolute; left: 50%; bottom: calc(var(--safe-bottom) + 10px); z-index: 2;
  width: 58px; height: 58px; margin-left: -29px; border-radius: 18px; display: grid; place-items: center;
  background: #fff; color: #0a84ff; box-shadow: 0 14px 34px -10px rgba(0, 0, 0, 0.8);
  animation: install-bounce 1.2s ease-in-out infinite;
}
.install-arrow::after { content: ""; position: absolute; bottom: -10px; left: 50%; margin-left: -9px; border: 9px solid transparent; border-top-color: #fff; border-bottom: 0; }
.install-arrow.top { top: calc(env(safe-area-inset-top, 0px) + 10px); bottom: auto; left: auto; right: 18px; margin: 0; }
.install-arrow.top::after { top: -10px; bottom: auto; border-top: 0; border-bottom: 9px solid #fff; }
.install-arrow .i { width: 28px; height: 28px; }
@keyframes install-bounce { 50% { transform: translateY(8px); } }
.install-arrow.top { animation-name: install-bounce-up; }
@keyframes install-bounce-up { 50% { transform: translateY(-6px); } }

/* ======================================================================
   PC: finestre al centro (gestionale e app clienti) e app clienti a tutto schermo
   ====================================================================== */
.desk-nav { display: none; }
@keyframes photo-in { from { transform: scale(1.06); filter: saturate(0.8) brightness(0.8); } to { transform: none; filter: none; } }
@keyframes modal-in { from { opacity: 0; transform: translate(-50%, -47%) scale(0.97); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes modal-out { from { opacity: 1; transform: translate(-50%, -50%); } to { opacity: 0; transform: translate(-50%, -48%) scale(0.98); } }

/* Tablet: colonna un po' più larga */
@media (min-width: 700px) and (max-width: 1023px) {
  body.client #app { max-width: 640px; }
}

@media (min-width: 1024px) {
  /* I fogli dal basso diventano finestre al centro dello schermo */
  .sheet { top: 50%; bottom: auto; width: min(600px, calc(100% - 48px)); max-height: min(88dvh, 900px); padding: 26px 30px 24px; border-radius: 26px; border-bottom: 1px solid var(--line-strong); transform: translate(-50%, -50%); box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.9); animation: modal-in 0.3s var(--ease) both; }
  .sheet.closing { animation: modal-out 0.2s var(--ease) both; }
  .sheet-handle { display: none; }

  body.client #app { max-width: none; padding-top: 0; }

  /* Accesso: foto della palestra a sinistra, modulo a destra */
  body.client .auth { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(460px, 0.92fr); grid-template-rows: auto 1fr auto auto; padding: 0; }
  body.client .auth::before {
    content: ""; grid-column: 1; grid-row: 1 / -1;
    background:
      radial-gradient(circle at 16% 10%, rgba(198, 239, 112, 0.2), transparent 32%),
      linear-gradient(90deg, rgba(5, 12, 8, 0.86), rgba(5, 12, 8, 0.34)),
      linear-gradient(0deg, rgba(7, 9, 7, 0.85), transparent 46%),
      url("https://static.wixstatic.com/media/9b252c_cef71c08ec284eca8d7c9742b3804dc0~mv2.jpg/v1/fill/w_1581,h_1064,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/9b252c_cef71c08ec284eca8d7c9742b3804dc0~mv2.jpg") center / cover no-repeat,
      #0d140c;
    animation: photo-in 1.3s var(--ease) both;
  }
  body.client .auth-bg { left: 54%; }
  body.client .auth > .brand, body.client .auth > .auth-back { grid-column: 1; grid-row: 1; align-self: start; padding: 48px 56px 0; }
  body.client .auth-back .back-link { color: rgba(255, 255, 255, 0.85); }
  body.client .auth > .auth-hero { grid-column: 1; grid-row: 3 / span 2; align-self: end; margin: 0; padding: 0 56px 56px; }
  body.client .auth h1 { font-size: clamp(52px, 5.6vw, 84px); line-height: 0.95; }
  body.client .auth .sub { max-width: 42ch; margin: 0; color: rgba(255, 255, 255, 0.86); font-size: 17px; line-height: 1.6; }
  body.client .auth > .auth-card, body.client .auth > .profiles { grid-column: 2; grid-row: 1 / 4; align-self: center; justify-self: center; width: min(440px, calc(100% - 64px)); }
  body.client .auth > .auth-card { padding: 30px 28px 24px; }
  body.client .auth > .auth-foot { grid-column: 2; grid-row: 4; margin: 0; padding: 0 0 32px; }

  /* Menu in alto al posto della barra in basso */
  body.client .desk-nav { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px; height: 78px; padding: 0 clamp(24px, 4vw, 56px); background: rgba(7, 9, 7, 0.8); border-bottom: 1px solid var(--line); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%); }
  .desk-nav .brand svg { width: 40px; height: 40px; }
  .desk-tabs { display: flex; gap: 4px; margin: 0 auto; padding: 5px; border-radius: 18px; background: rgba(var(--tint), 0.035); border: 1px solid var(--line); }
  .desk-tab { display: inline-flex; align-items: center; gap: 9px; height: 44px; padding: 0 18px; border-radius: 13px; border: 1px solid transparent; color: var(--muted); font-size: 15px; font-weight: 700; transition: color 0.2s, background 0.2s, border-color 0.2s; }
  .desk-tab .i { width: 19px; height: 19px; }
  .desk-tab:hover { color: var(--text); background: rgba(var(--tint), 0.04); }
  .desk-tab.active { color: var(--lime); background: linear-gradient(160deg, rgba(212, 247, 90, 0.2), rgba(149, 193, 31, 0.1)); border-color: rgba(191, 232, 74, 0.3); }
  .desk-tab .badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center; background: var(--lime); color: var(--lime-ink); font-size: 11.5px; font-weight: 800; }
  .desk-me { display: flex; align-items: center; gap: 16px; }
  .desk-me .avatar { width: 40px; height: 40px; border-radius: 13px; font-size: 14px; }
  .desk-me .hello strong { font-size: 16px; }
  body.client .shell { max-width: 1160px; min-height: 0; margin: 0 auto; padding: 36px clamp(24px, 4vw, 48px) 80px; }
  body.client .shell > .topbar, body.client .tabbar { display: none; }
  body.client .page-head h1 { font-size: 40px; }

  /* Prenota: i 14 giorni tutti visibili, lezioni su due colonne */
  body.client .days { overflow: visible; margin: 0 0 6px; padding: 4px 0 10px; scroll-snap-type: none; }
  body.client .day { flex: 1 1 0; width: auto; min-width: 0; height: 86px; }
  body.client .book-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

  /* Le mie e Abbonamento: due colonne */
  body.client .cols { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 36px; align-items: start; }
  body.client .cols > div > :first-child { margin-top: 0; }
}

@media (min-width: 1024px) and (hover: hover) and (pointer: fine) {
  body.client .lesson:hover, body.client .booking-card:hover, body.client .profile-btn:hover { border-color: rgba(191, 232, 74, 0.35); transform: translateY(-1px); }
  body.client .day:not(.selected):hover { border-color: rgba(191, 232, 74, 0.35); }
}

/* Scritta sulle installazioni di prova (LIVINFIT_TEST_MODE) */
body[data-test-mode]::after { content: "VERSIONE DI PROVA"; position: fixed; z-index: 90; top: calc(var(--safe-top) + 6px); left: 50%; transform: translateX(-50%); padding: 3px 12px; border-radius: 999px; background: #f5be4f; color: #1d1404; font-size: 11px; font-weight: 800; letter-spacing: 0.08em; white-space: nowrap; pointer-events: none; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.5); }

/* Guida all'installazione: senza freccia sotto non serve lo spazio extra, e su PC è una finestra al centro */
.install-sheet.no-arrow { padding-bottom: calc(var(--safe-bottom) + 22px); }
.install-steps small b { color: var(--text); }
@media (min-width: 1024px) {
  .install-sheet { top: 50%; bottom: auto; width: min(520px, calc(100% - 48px)); max-height: 88dvh; overflow-y: auto; padding: 26px 30px 22px; border-radius: 26px; border-bottom: 1px solid var(--line-strong); transform: translate(-50%, -50%); animation: modal-in 0.3s var(--ease) both; }
  .install-layer.closing .install-sheet { animation: modal-out 0.2s var(--ease) both; }
  .install-sheet .sheet-handle, .install-arrow { display: none; }
}
