@font-face{font-family:'Inter';font-style:normal;font-weight:400;font-display:swap;src:url(fonts/inter-400.woff2) format('woff2')}
@font-face{font-family:'Inter';font-style:normal;font-weight:600;font-display:swap;src:url(fonts/inter-600.woff2) format('woff2')}
@font-face{font-family:'Inter';font-style:normal;font-weight:700;font-display:swap;src:url(fonts/inter-700.woff2) format('woff2')}
@font-face{font-family:'Barlow Condensed';font-style:normal;font-weight:700;font-display:swap;src:url(fonts/barlow-condensed-700.woff2) format('woff2')}
@font-face{font-family:'Barlow Condensed';font-style:normal;font-weight:800;font-display:swap;src:url(fonts/barlow-condensed-800.woff2) format('woff2')}
@font-face{font-family:'Barlow Condensed';font-style:italic;font-weight:800;font-display:swap;src:url(fonts/barlow-condensed-800-italic.woff2) format('woff2')}
:root {
  --pt-accent: #c8102e;
  --pt-accent-dark: #9b0b22;
  --pt-grad: linear-gradient(135deg, #d4142f 0%, #8f0a1f 45%, #1a0508 100%);
  --pt-grad-soft: linear-gradient(180deg, #b50e28 0%, #4a0812 55%, #0d0305 100%);
  --pt-bg: #f6f4f4;
  --pt-card: #ffffff;
  --pt-ink: #1a1214;
  --pt-muted: #6b5f62;
  --pt-line: #e5dcdd;
  --pt-head: #f1ecec;
  --pt-hover: #faf6f6;
  --pt-danger: #b91c1c;
  --pt-warn: #b45309;
  --pt-ok: #15803d;
  --pt-input: #ffffff;
  --pt-t2: #4f4346;
  --pt-accent-soft: #fde7ea;
  --pt-ok-soft: #e2f4e9;
  --pt-warn-soft: #fff0d4;
  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-body: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-primary: var(--pt-accent);
  --bs-primary-rgb: 200, 16, 46;
  --bs-link-color: var(--pt-accent);
  --bs-link-hover-color: var(--pt-accent-dark);
  color-scheme: light;
}
:root[data-bs-theme="dark"] {
  --pt-accent: #ff4d63;
  --pt-accent-dark: #e02a42;
  --pt-grad: linear-gradient(135deg, #d4142f 0%, #7a0a1b 50%, #0b0305 100%);
  --pt-grad-soft: linear-gradient(180deg, #8f0a1f 0%, #3a0710 50%, #070203 100%);
  --pt-bg: #0f0b0c;
  --pt-card: #1a1415;
  --pt-ink: #f6eff0;
  --pt-muted: #a89b9e;
  --pt-line: #3a2e30;
  --pt-head: #261d1f;
  --pt-hover: #211819;
  --pt-danger: #ff7a7a;
  --pt-warn: #fbbf24;
  --pt-ok: #4ade80;
  --pt-input: #150f10;
  --pt-t2: #d2c6c8;
  --pt-accent-soft: #3a1219;
  --pt-ok-soft: #123020;
  --pt-warn-soft: #3a2a08;
  --bs-primary-rgb: 255, 77, 99;
  --bs-body-bg: var(--pt-bg);
  --bs-body-color: var(--pt-ink);
  --bs-border-color: var(--pt-line);
  color-scheme: dark;
}html, body { font-family: var(--font-body); background: var(--pt-bg); color: var(--pt-ink); }
a { color: var(--pt-accent); }
h1 { font-family: var(--font-display); font-style: italic; font-weight: 800; text-transform: uppercase; font-size: 2rem; line-height: 1.05; margin-bottom: 1rem; }
h2 { font-size: 1.2rem; font-weight: 600; }
.btn-primary { --bs-btn-color: #fff; --bs-btn-hover-color: #fff; --bs-btn-active-color: #fff; --bs-btn-disabled-color: #fff; --bs-btn-border-color: transparent; --bs-btn-hover-border-color: transparent; --bs-btn-active-border-color: transparent; --bs-btn-bg: #b50e28; background-image: var(--pt-grad); border: 0; }
.btn-primary:hover, .btn-primary:focus-visible { filter: brightness(1.12); background-image: var(--pt-grad); }
.btn-primary:disabled { background-image: var(--pt-grad); opacity: .55; }
.btn-outline-primary { --bs-btn-color: var(--pt-accent); --bs-btn-border-color: var(--pt-accent); --bs-btn-hover-bg: #b50e28; --bs-btn-hover-border-color: #b50e28; --bs-btn-hover-color: #fff; --bs-btn-active-bg: #8f0a1f; --bs-btn-active-border-color: #8f0a1f; --bs-btn-active-color: #fff; }
.form-control:focus, .form-select:focus, .btn:focus-visible { border-color: var(--pt-accent); box-shadow: 0 0 0 .2rem rgba(200,16,46,.3); }
.card-pt { background: var(--pt-card); border: 1px solid var(--pt-line); border-radius: 12px; padding: 1rem 1.1rem; margin-bottom: 1rem; }
.card-pt > h2:first-child { margin-top: 0; }
.muted { color: var(--pt-muted); }
.small-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--pt-muted); }
.stat { font-family: var(--font-display); font-size: 2.2rem; font-weight: 700; line-height: 1.05; }
.badge-ok { background: rgba(21,128,61,.16); color: var(--pt-ok); } .badge-warn { background: rgba(217,119,6,.18); color: var(--pt-warn); } .badge-danger { background: rgba(220,38,38,.16); color: var(--pt-danger); } .badge-grey { background: rgba(120,100,104,.2); color: var(--pt-muted); }
.grid-stat { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; }
.grid-stat .card-pt { margin: 0; }
.table > :not(caption) > * > * { padding: .5rem .6rem; }
.table-pt { background: var(--pt-card); border-radius: 12px; overflow: hidden; border: 1px solid var(--pt-line); }
.table-pt thead th { background: var(--pt-head); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--pt-muted); font-weight: 600; white-space: nowrap; }
.table-pt tbody tr:hover { background: var(--pt-hover); }
.table-pt, .table-pt .table { --bs-table-bg: var(--pt-card); --bs-table-color: var(--pt-ink); --bs-table-border-color: var(--pt-line); }
.tabs-pt { display: flex; gap: .25rem; border-bottom: 1px solid var(--pt-line); margin-bottom: 1rem; overflow-x: auto; }
.tabs-pt button { background: none; border: none; padding: .6rem .9rem; border-bottom: 3px solid transparent; color: var(--pt-muted); font-weight: 550; white-space: nowrap; }
.tabs-pt button.attivo { color: var(--pt-accent); border-bottom-color: var(--pt-accent); }
.avviso { display: flex; gap: .6rem; align-items: center; padding: .55rem .8rem; border-radius: 8px; margin-bottom: .4rem; border-left: 4px solid; background: var(--pt-card); }
.avviso.danger { border-color: var(--pt-danger); } .avviso.warning { border-color: var(--pt-warn); } .avviso.info { border-color: var(--pt-accent); }
.progress-macro { height: 10px; background: var(--pt-line); border-radius: 6px; overflow: hidden; }
.progress-macro > div { height: 100%; border-radius: 6px; background: var(--pt-grad); }
.progress-macro.over > div { background: var(--pt-danger); }

/* Account */
.account-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; background: var(--pt-grad-soft); }
.account-card { background: var(--pt-card); color: var(--pt-ink); padding: 2rem; border-radius: 16px; width: 100%; max-width: 420px; box-shadow: 0 8px 30px rgba(15,23,42,.08); }
.account-card .brand { color: var(--pt-accent); font-weight: 700; margin-bottom: 1rem; letter-spacing: .02em; }

/* Layout PT */
.pt-shell { display: flex; min-height: 100vh; }
.pt-sidebar { width: 230px; background: var(--pt-grad-soft); color: #fff; display: flex; flex-direction: column; padding: 1rem .75rem; position: sticky; top: 0; height: 100vh; flex-shrink: 0; }
.pt-brand { font-weight: 700; font-size: 1.1rem; padding: .5rem .75rem 1.25rem; }
.pt-sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.pt-sidebar nav a { color: #e8d9db; text-decoration: none; padding: .55rem .75rem; border-radius: 8px; }
.pt-sidebar nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.pt-sidebar nav a.active { background: rgba(255,255,255,.16); color: #fff; box-shadow: inset 3px 0 0 #fff; }
.pt-sidebar-foot { padding: .5rem .75rem; }
.pt-sidebar-foot .attribuzione { margin-top: .75rem; font-size: .75rem; } .pt-sidebar-foot .attribuzione a { color: #d1b8bb; }
.pt-main { flex: 1; min-width: 0; }
.pt-top { padding: .5rem 1rem 0; }
.pt-content { padding: 1rem 1.5rem 3rem; }
@media (max-width: 991px) {
  .pt-sidebar { position: fixed; left: -240px; z-index: 1030; transition: left .2s; }
  .pt-sidebar.aperto { left: 0; }
  .pt-content { padding: 1rem; }
}
.scheda-tabella td, .scheda-tabella th { vertical-align: middle; }
.scheda-tabella input.form-control, .scheda-tabella select.form-select { padding: .2rem .4rem; font-size: .9rem; min-width: 50px; }
.jump-1 { background: #fde68a55; } .jump-2 { background: #bfdbfe66; } .jump-3 { background: #fbcfe866; } .jump-4 { background: #bbf7d066; } .jump-5 { background: #ddd6fe66; }
.jump-chip { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .75rem; }

/* Layout atleta (telefono) */
.at-shell { max-width: 560px; margin: 0 auto; min-height: 100vh; padding-bottom: 84px; }
@media (min-width: 992px) { .at-shell { max-width: 960px; } .at-content { padding-left: 2rem; padding-right: 2rem; } }
.at-content { padding: 1rem 1rem 1.5rem; padding-top: max(1rem, env(safe-area-inset-top)); }
.at-bottom { position: fixed; bottom: 0; left: 0; right: 0; background: var(--pt-card); border-top: 1px solid var(--pt-line); display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); z-index: 1000; }
.at-bottom a { flex: 1; max-width: 140px; text-align: center; padding: .55rem 0 .45rem; font-size: .75rem; color: var(--pt-muted); text-decoration: none; display: flex; flex-direction: column; align-items: center; }
.at-bottom a .ico { font-size: 1.35rem; line-height: 1.2; }
.at-bottom a.active { color: var(--pt-accent); font-weight: 650; }
.btn-xl { padding: .9rem 1rem; font-size: 1.1rem; border-radius: 12px; width: 100%; }
.serie-riga { display: grid; grid-template-columns: 2rem 1fr 1fr 3rem; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.serie-riga.fatta { opacity: .7; }
.stepper { display: flex; align-items: stretch; }
.stepper button { width: 2.4rem; border: 1px solid var(--pt-line); background: var(--pt-card); color: var(--pt-ink); font-size: 1.3rem; border-radius: 8px; }
.stepper input { width: 100%; min-width: 0; text-align: center; font-size: 1.15rem; font-weight: 600; border: 1px solid var(--pt-line); border-radius: 8px; margin: 0 .25rem; padding: .45rem 0; background: var(--pt-input); color: var(--pt-ink); }
.prec { font-size: .72rem; color: var(--pt-muted); text-align: center; }
.esercizio-card { background: var(--pt-card); border: 1px solid var(--pt-line); border-radius: 14px; padding: .9rem; margin-bottom: .8rem; border-left-width: 6px; }
.timer-flottante { position: fixed; bottom: 76px; left: 50%; transform: translateX(-50%); background: var(--pt-grad); color: #fff; padding: .6rem 1.2rem; border-radius: 999px; z-index: 1010; display: flex; gap: .8rem; align-items: center; box-shadow: 0 6px 20px rgba(0,0,0,.25); font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.timer-flottante button { background: none; border: none; color: #fff; font-size: 1rem; opacity: .8; }
.overlay { position: fixed; inset: 0; background: rgba(15,23,42,.65); z-index: 1100; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.overlay .contenuto { background: var(--pt-card); color: var(--pt-ink); border-radius: 14px; padding: 1rem; width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; }
.overlay video { width: 100%; border-radius: 10px; background: #000; }
.cibo-riga { display: flex; justify-content: space-between; align-items: center; padding: .55rem 0; border-bottom: 1px solid var(--pt-line); gap: .5rem; }
.cibo-riga:last-child { border-bottom: none; }
.grafico { width: 100%; height: auto; }
.valid-modified:not(.invalid) { outline: none; } .validation-message { color: var(--pt-danger); font-size: .85rem; }
#blazor-error-ui { color-scheme: light only; color: #211a1b; background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); box-sizing: border-box; display: none; left: 0; padding: .6rem 1.25rem .7rem 1.25rem; position: fixed; width: 100%; z-index: 2000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
/* Intestazioni e dettagli in tema: titoli con tratto rosso, tab attivo, link */
h1 { letter-spacing: -.01em; }
h1::after { content: ""; display: block; width: 44px; height: 3px; margin-top: .35rem; border-radius: 2px; background: var(--pt-grad); }
.account-card h1::after { margin-bottom: .25rem; }
.card-pt { color: var(--pt-ink); }
.form-control, .form-select { background-color: var(--pt-input); color: var(--pt-ink); border-color: var(--pt-line); }
.form-control::placeholder { color: var(--pt-muted); }
.form-floating > label { color: var(--pt-muted); }
.muted, .text-muted { color: var(--pt-muted) !important; }
.grafico-linea { stroke: var(--pt-accent); } .grafico-punto { fill: var(--pt-accent); } .grafico-asse { stroke: var(--pt-line); } .grafico-testo { fill: var(--pt-muted); }
.brand, .pt-brand { background: none; }
.account-card .brand { background: var(--pt-grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-size: 1.15rem; }
.tema-toggle { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.3); border-radius: 8px; padding: .25rem .6rem; font-size: .85rem; }
.tema-toggle.chiaro { background: var(--pt-card); color: var(--pt-ink); border-color: var(--pt-line); }
:root[data-bs-theme="dark"] .btn-outline-secondary { --bs-btn-color: var(--pt-ink); --bs-btn-border-color: var(--pt-line); --bs-btn-hover-bg: var(--pt-head); --bs-btn-hover-color: var(--pt-ink); }
:root[data-bs-theme="dark"] .btn-close { filter: invert(1); }
:root[data-bs-theme="dark"] .alert { --bs-alert-bg: var(--pt-card); --bs-alert-border-color: var(--pt-line); }
h1:focus, h1:focus-visible { outline: none; }

/* ===== Allenamento in corso (design) ===== */
.wk-head { position: sticky; top: 0; z-index: 20; background: var(--pt-card); border-bottom: 1px solid var(--pt-line); margin: -1rem -1rem 12px; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); }
.wk-head-row { display: flex; align-items: center; gap: 10px; }
.wk-title { font-family: var(--font-display); font-weight: 800; font-style: italic; font-size: 28px; line-height: 1; text-transform: uppercase; margin: 0; }
.wk-title::after { display: none; }
.wk-count { text-align: right; font-family: var(--font-display); font-weight: 700; font-size: 26px; line-height: 1; }
.wk-count small { font-size: 16px; color: var(--pt-muted); }
.wk-progress { height: 6px; border-radius: 3px; background: var(--pt-head); margin-top: 10px; }
.wk-progress > div { height: 6px; border-radius: 3px; background: var(--pt-grad); transition: width .2s; }
.icon-btn { width: 44px; height: 44px; border: 1px solid var(--pt-line); border-radius: 12px; background: var(--pt-card); color: var(--pt-ink); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.wk-retro { background: var(--pt-warn-soft); color: var(--pt-warn); border-radius: 14px; padding: 10px 14px; font-size: 14px; margin-bottom: 10px; }
.wk-retro input[type=date] { background: var(--pt-card); color: var(--pt-ink); border: 1px solid var(--pt-line); border-radius: 8px; padding: 2px 6px; }
.wk-block { border: 2px solid var(--pt-line); border-radius: 18px; overflow: hidden; background: var(--pt-card); margin-bottom: 10px; }
.wk-block.jump { border-color: #b45309; }
.wk-block-head { background: #b45309; color: #fff; padding: 7px 14px; font-size: 12px; font-weight: 700; display: flex; justify-content: space-between; }
.wk-ex { padding: 12px 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.wk-ex + .wk-ex { border-top: 1px solid var(--pt-line); }
.wk-ex-head { display: flex; gap: 10px; align-items: flex-start; }
.wk-letter { width: 28px; height: 28px; border-radius: 8px; background: var(--pt-warn-soft); color: var(--pt-warn); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex: none; }
.wk-ex-name { font-size: 16px; font-weight: 700; }
.wk-ex-meta { font-size: 13px; color: var(--pt-t2); }
.wk-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--pt-muted); }
.wk-hint { display: flex; gap: 8px; background: var(--pt-ok-soft); color: var(--pt-ok); border-radius: 10px; padding: 8px 10px; font-size: 13px; line-height: 1.35; }
.wk-done { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border-radius: 10px; background: var(--pt-ok-soft); color: var(--pt-ok); font-size: 14px; }
.wk-done .val { flex: 1; font-variant-numeric: tabular-nums; color: var(--pt-ink); }
.wk-future { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border-radius: 10px; border: 1px dashed var(--pt-line); color: var(--pt-muted); font-size: 14px; }
.wk-future .val { flex: 1; font-variant-numeric: tabular-nums; }
.wk-active { border-radius: 16px; padding: 12px; background: var(--pt-accent-soft); border: 2px solid var(--pt-accent); display: flex; flex-direction: column; gap: 10px; }
.wk-active-top { display: flex; justify-content: space-between; font-size: 13px; }
.wk-active-top b { color: var(--pt-accent); }
.wk-steppers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.wk-steppers.solo { grid-template-columns: 1fr; }
.wk-stepper { display: flex; align-items: center; background: var(--pt-card); border-radius: 14px; height: 60px; overflow: hidden; border: 1px solid var(--pt-line); }
.wk-stepper button { width: 40px; flex: none; height: 60px; border: 0; background: var(--pt-head); color: var(--pt-ink); font-size: 26px; }
.wk-stepper input { flex: 1; min-width: 0; width: 100%; padding: 0; text-align: center; border: 0; outline: none; background: transparent; color: var(--pt-ink); font-family: var(--font-display); font-weight: 700; font-size: 30px; font-variant-numeric: tabular-nums; }
.wk-unit { font-size: 12px; color: var(--pt-t2); text-align: center; margin-top: 4px; }
.wk-unit b.up { color: var(--pt-ok); }
.wk-fatta { height: 60px; border: 0; border-radius: 14px; background: #16a34a; color: #fff; font: 700 17px var(--font-body); display: flex; align-items: center; justify-content: center; gap: 10px; }
.wk-next { background: var(--pt-card); border: 1px solid var(--pt-line); border-radius: 14px; padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; font-size: 14px; margin-bottom: 8px; }
.wk-conclude { height: 56px; border-radius: 14px; border: 2px solid var(--pt-ink); background: transparent; color: var(--pt-ink); font: 700 16px var(--font-body); width: 100%; }
.wk-all { height: 48px; border-radius: 12px; border: 1px solid var(--pt-accent); background: transparent; color: var(--pt-accent); font: 700 15px var(--font-body); width: 100%; margin-bottom: 10px; }
.timer-flottante { left: 12px; right: 12px; transform: none; bottom: 80px; height: 76px; border-radius: 22px; padding: 0 10px 0 14px; display: flex; gap: 10px; align-items: center; font-size: 1rem; background: linear-gradient(120deg, #d4142f 0%, #8a0b1d 55%, #1a0508 100%); }
.timer-flottante .t-label { font-size: 11px; font-weight: 700; letter-spacing: 1.2px; color: #ffc2ca; display: block; }
.timer-flottante .t-time { font-family: var(--font-display); font-weight: 700; font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; }
.timer-flottante .t-btn { height: 48px; padding: 0 14px; border-radius: 14px; border: 1px solid rgba(255,255,255,.45); background: transparent; color: #fff; font: 700 14px var(--font-body); opacity: 1; }
.timer-flottante .t-btn.pieno { background: #fff; color: #8a0b1d; border: 0; }
/* ===== Mobile: tabelle impilate e editor a schede ===== */
@media (max-width: 767.98px) {
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: .65rem .85rem; border-bottom: 1px solid var(--pt-line); }
  .table-stack tr:last-child { border-bottom: 0; }
  .table-stack td { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .22rem 0 !important; border: 0 !important; text-align: right; background: transparent !important; }
  .table-stack td[data-label]::before { content: attr(data-label); flex: none; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--pt-muted); text-align: left; }
  .table-stack td:first-child:not([data-label]) { display: block; text-align: left; font-weight: 700; font-size: 1.02rem; padding-bottom: .35rem !important; }
  .table-stack td.az { justify-content: flex-end; padding-top: .5rem !important; flex-wrap: wrap; }
  .table-stack td.no-label { display: block; text-align: center; }
  .table-stack td .form-control, .table-stack td .form-select { max-width: 60%; }
  .table-pt { border-radius: 12px; }

  /* Editor della scheda: ogni esercizio è una scheda a griglia */
  .scheda-tabella { display: block; }
  .scheda-tabella thead { display: none; }
  .scheda-tabella tbody { display: block; }
  .scheda-tabella tr { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem .6rem; padding: .75rem; margin-bottom: .6rem; border: 1px solid var(--pt-line); border-radius: 12px; background: var(--pt-card); }
  .scheda-tabella td { display: block; padding: 0 !important; border: 0 !important; background: transparent !important; }
  .scheda-tabella td[data-label]::before { content: attr(data-label); display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--pt-muted); margin-bottom: .15rem; }
  .scheda-tabella td.mh { display: none; }
  .scheda-tabella td.ed-es, .scheda-tabella td.ed-ob, .scheda-tabella td.az { grid-column: 1 / -1; }
  .scheda-tabella td.az { display: flex; justify-content: space-between; }
  .scheda-tabella td.text-center { text-align: left !important; }
  .scheda-tabella input.form-control, .scheda-tabella select.form-select { padding: .5rem .6rem; font-size: 1rem; min-height: 44px; width: 100%; }
  .scheda-tabella .form-check-input { width: 1.6rem; height: 1.6rem; }
  .scheda-tabella td.az .btn { min-height: 44px; min-width: 44px; }
}
@media (max-width: 575.98px) {
  .pt-content { padding: .75rem .75rem 3rem; }
  .btn, .form-control, .form-select { min-height: 44px; }
  .btn-sm { min-height: 38px; }
  h1 { font-size: 1.7rem; }
  .tabs-pt button { padding: .7rem .8rem; }
  .grid-stat { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .grid-stat .card-pt { padding: .75rem; }
  .stat { font-size: 1.8rem; }
}
/* ===== Area atleta su computer: menu laterale, colonne, schermata di allenamento centrata ===== */
.at-side { display: none; }
.at-cols { display: block; }
@media (min-width: 992px) {
  .at-shell { max-width: none; margin: 0; display: flex; padding-bottom: 0; min-height: 100vh; }
  .at-side { display: flex; flex-direction: column; width: 230px; flex: none; position: sticky; top: 0; height: 100vh; background: var(--pt-grad-soft); color: #fff; padding: 1rem .75rem; }
  .at-side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
  .at-side nav a { color: #e8d9db; text-decoration: none; padding: .6rem .75rem; border-radius: 8px; }
  .at-side nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
  .at-side nav a.active { background: rgba(255,255,255,.16); color: #fff; box-shadow: inset 3px 0 0 #fff; }
  .at-bottom { display: none; }
  .at-content { flex: 1; min-width: 0; max-width: 1180px; padding: 1.5rem 2rem 3rem; }
  .at-cols { column-count: 2; column-gap: 1rem; }
  .at-cols > * { break-inside: avoid; }
  .at-cols .card-pt { margin-bottom: 1rem; }
  /* Allenamento: colonna centrata e leggibile, header a tutta larghezza del contenuto */
  .wk-head { margin: -1.5rem -2rem 14px; padding-left: 2rem; padding-right: 2rem; }
  .at-content > .wk-block, .at-content > .wk-retro, .at-content > .wk-all, .at-content > .card-pt, .at-content > .wk-conclude { max-width: 720px; margin-left: auto; margin-right: auto; display: block; }
  .at-content > .wk-block { display: block; }
  .at-content > .wk-conclude { display: block; width: 100%; }
  .timer-flottante { left: calc(50% + 115px); right: auto; transform: translateX(-50%); width: min(520px, 90vw); bottom: 24px; }
  .wk-stepper input { font-size: 34px; }
}
@media (min-width: 1500px) { .at-cols { column-count: 3; } }
/* ===== Calendario (DatePicker) ===== */
.dp { position: relative; display: block; }
.dp.dp-compact, .dp.dp-inline { display: inline-block; }
.dp-input { display: flex; align-items: center; justify-content: space-between; gap: .6rem; text-align: left; cursor: pointer; min-width: 150px; }
.dp-input svg { flex: none; color: var(--pt-muted); }
.dp-vuoto { color: var(--pt-muted); }
.dp.dp-inline .dp-input { display: inline-flex; min-width: 0; min-height: 0; padding: .1rem .5rem; font-weight: 600; vertical-align: baseline; }
.dp.dp-compact .dp-input { padding: .35rem .6rem; min-height: 0; font-size: .9rem; min-width: 140px; }
.dp-backdrop { position: fixed; inset: 0; z-index: 1059; background: transparent; }
.dp-pop { position: absolute; z-index: 1060; top: calc(100% + 6px); left: 0; width: 304px; max-width: calc(100vw - 24px); background: var(--pt-card); color: var(--pt-ink); border: 1px solid var(--pt-line); border-radius: 16px; padding: 12px; box-shadow: 0 18px 48px rgba(26, 5, 8, .28); }
.dp-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.dp-titolo { flex: 1; text-align: center; font-weight: 700; text-transform: capitalize; }
.dp-nav { width: 40px; height: 40px; border: 1px solid var(--pt-line); border-radius: 10px; background: var(--pt-card); color: var(--pt-ink); display: inline-flex; align-items: center; justify-content: center; }
.dp-nav:hover { background: var(--pt-head); }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-dow span { text-align: center; font-size: .72rem; font-weight: 700; color: var(--pt-muted); padding: 4px 0; }
.dp-day { aspect-ratio: 1; min-height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--pt-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.dp-day:hover:not(:disabled) { background: var(--pt-accent-soft); }
.dp-day.fuori { color: var(--pt-muted); font-weight: 400; opacity: .6; }
.dp-day.oggi { box-shadow: inset 0 0 0 2px var(--pt-accent); }
.dp-day.sel { background: var(--pt-grad); color: #fff; opacity: 1; }
.dp-day:disabled { opacity: .3; cursor: not-allowed; }
.dp-foot { display: flex; gap: 6px; margin-top: 10px; }
@media (max-width: 575.98px) {
  .dp-pop { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; max-width: none; border-radius: 22px 22px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); box-shadow: 0 -16px 48px rgba(0, 0, 0, .4); }
  .dp-day { min-height: 44px; }
  .dp-backdrop { background: rgba(15, 11, 12, .55); }
}

/* ===== Menu a tendina (select) ===== */
select, select.form-select {
  -webkit-appearance: none; appearance: none;
  background-color: var(--pt-input); color: var(--pt-ink);
  border: 1px solid var(--pt-line); border-radius: 10px;
  padding-right: 2.4rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23989' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .8rem center; background-size: 16px;
}
select:hover { border-color: var(--pt-accent); }
option, optgroup { background: var(--pt-card); color: var(--pt-ink); }
optgroup { font-weight: 700; font-style: normal; color: var(--pt-muted); }
/* Elenco aperto personalizzato dove il browser lo supporta (Chrome/Edge recenti): il resto usa l'elenco di sistema, già a tema */
@supports (appearance: base-select) {
  select, select::picker(select) { appearance: base-select; }
  select::picker-icon { display: none; }
  select::picker(select) { background: var(--pt-card); border: 1px solid var(--pt-line); border-radius: 12px; padding: 6px; box-shadow: 0 18px 48px rgba(26, 5, 8, .28); margin-top: 4px; max-height: 320px; }
  select option { padding: .55rem .75rem; border-radius: 8px; cursor: pointer; }
  select option:hover, select option:focus { background: var(--pt-accent-soft); }
  select option:checked { background: var(--pt-grad); color: #fff; }
  select option::checkmark { display: none; }
  select optgroup { padding: .4rem .75rem .1rem; }
}

/* Campi data/ora nativi rimasti (appuntamenti): colore tema e icona leggibile */
input[type="datetime-local"], input[type="time"] { background-color: var(--pt-input); color: var(--pt-ink); border-color: var(--pt-line); border-radius: 10px; }
input[type="datetime-local"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .8; }
:root[data-bs-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(1); }
/* Icone SVG */
.ico-svg { vertical-align: -.18em; flex: none; }
.btn .ico-svg { vertical-align: -.2em; }
.at-bottom a .ico { display: inline-flex; height: 26px; align-items: center; }
.tema-toggle { display: inline-flex; align-items: center; gap: .4rem; }
.wk-unit b.up { display: inline-flex; align-items: center; gap: 2px; }

/* ===== Selezione (menu a tendina proprio) ===== */
.sel { position: relative; display: block; }
.sel.sel-filtro { display: inline-block; min-width: 200px; }
.sel-btn { text-align: left; cursor: pointer; width: 100%; min-height: 38px; display: flex; align-items: center; }
.sel-btn:disabled { opacity: .6; cursor: not-allowed; }
.sel-vuoto { color: var(--pt-muted); }
.sel-list, .dp-pop { visibility: hidden; }
.sel-list.pos, .dp-pop.pos { visibility: visible; }
.sel-list { position: fixed; top: 0; left: 0; z-index: 1060; margin: 0; padding: 6px; list-style: none; max-height: min(340px, 60vh); overflow: auto; background: var(--pt-card); color: var(--pt-ink); border: 1px solid var(--pt-line); border-radius: 12px; box-shadow: 0 18px 48px rgba(26, 5, 8, .28); }
.sel-opt { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .6rem .75rem; border-radius: 8px; cursor: pointer; }
.sel-opt:hover, .sel-opt.sel-evid { background: var(--pt-accent-soft); }
.sel-opt.sel-corrente { font-weight: 700; color: var(--pt-accent); }
.sel-gruppo { padding: .55rem .75rem .15rem; font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--pt-muted); }
@media (max-width: 575.98px) {
  .sel-list { position: fixed; left: 0; right: 0; bottom: 0; top: auto; max-height: 70vh; border-radius: 22px 22px 0 0; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); box-shadow: 0 -16px 48px rgba(0, 0, 0, .4); }
  .sel-opt { min-height: 48px; }
}

/* ===== Caricamento video: zona di trascinamento ===== */
.dropzone { position: relative; border: 2px dashed var(--pt-line); border-radius: 14px; background: var(--pt-card); transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.attiva { border-color: var(--pt-accent); background: var(--pt-accent-soft); }
.dropzone.occupata { cursor: progress; }
.dropzone-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone.occupata .dropzone-input { pointer-events: none; }
.dropzone-corpo { padding: 1.4rem 1rem; text-align: center; color: var(--pt-ink); pointer-events: none; }
.dropzone-corpo svg { color: var(--pt-accent); }
.video-anteprima { width: 100%; max-width: 420px; border-radius: 12px; background: #000; display: block; }

/* ===== Ritmo verticale e proporzioni (scala unica: 4 · 8 · 12 · 16 · 24 · 32) ===== */
:root { --sp-1: .25rem; --sp-2: .5rem; --sp-3: .75rem; --sp-4: 1rem; --sp-5: 1.5rem; --sp-6: 2rem; --raggio: 14px; }
.row { --bs-gutter-x: var(--sp-4); --bs-gutter-y: var(--sp-4); }
.row.g-2 { --bs-gutter-x: var(--sp-3); --bs-gutter-y: var(--sp-3); }
.row.g-3 { --bs-gutter-x: var(--sp-4); --bs-gutter-y: var(--sp-4); }

h1 { margin: 0 0 var(--sp-5); }
h1::after { width: 40px; height: 3px; margin-top: var(--sp-2); }
h2 { font-size: 1.125rem; font-weight: 700; margin: 0 0 var(--sp-4); line-height: 1.3; }
h2.h6 { font-size: 1rem; }
p { margin-bottom: var(--sp-3); }
p:last-child { margin-bottom: 0; }

/* Contenuto PT: respiro attorno e larghezza massima leggibile */
.pt-content { padding: var(--sp-6) var(--sp-6) 3.5rem; max-width: 1720px; margin-inline: auto; }
.pt-top { padding: var(--sp-3) var(--sp-4) 0; }
/* Intestazione di pagina: titolo e azioni allineati in basso, con lo stesso stacco ovunque */
.pt-content > .d-flex:first-child, .at-content > .d-flex:first-child { align-items: flex-end !important; margin-bottom: var(--sp-5); }
.pt-content > .d-flex:first-child > h1, .at-content > .d-flex:first-child > h1,
.pt-content > .d-flex:first-child h1 { margin-bottom: 0; }
.pt-content > .d-flex:first-child > div:first-child .muted { display: inline-block; margin-top: var(--sp-2); }

/* Riquadri */
.card-pt { padding: var(--sp-5); margin-bottom: var(--sp-4); border-radius: var(--raggio); }
.card-pt > :last-child { margin-bottom: 0; }
.card-pt > h2:first-child { margin-top: 0; }
.grid-stat { gap: var(--sp-4); margin-bottom: var(--sp-4); }
.grid-stat .card-pt { padding: var(--sp-4) var(--sp-5); }
.grid-stat .stat { margin-top: var(--sp-1); }
.small-label { margin-bottom: var(--sp-1); }
.avviso { padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-2); border-radius: 10px; }

/* Moduli: etichette e campi con la stessa proporzione */
.form-label { font-size: .85rem; font-weight: 600; color: var(--pt-t2); margin-bottom: .375rem; }
.form-control, .form-select, .sel-btn, .dp-input { padding: .6rem .85rem; border-radius: 10px; line-height: 1.4; }
.form-control-sm { padding: .4rem .65rem; font-size: .9rem; }
textarea.form-control { min-height: 96px; line-height: 1.5; resize: vertical; }
.form-text { margin-top: var(--sp-2); }
.btn { padding: .55rem 1rem; border-radius: 10px; font-weight: 600; }
.btn-sm { padding: .35rem .75rem; font-size: .85rem; }
.btn-xl { padding: 1rem; }
.mt-3 > .btn + .btn, .d-flex.gap-2 > .btn { margin: 0; }

/* Tab e tabelle */
.tabs-pt { gap: var(--sp-1); margin-bottom: var(--sp-5); }
.tabs-pt button { padding: var(--sp-3) var(--sp-4); }
.table > :not(caption) > * > * { padding: var(--sp-3) var(--sp-4); }
.table-pt { margin-bottom: var(--sp-4); }
.table-pt thead th { padding-top: var(--sp-3); padding-bottom: var(--sp-3); }

/* Elenco a righe (cibo, appuntamenti, storico) */
.cibo-riga { padding: var(--sp-3) 0; }

/* Messaggi/avvisi che precedono un modulo */
.alert { padding: var(--sp-3) var(--sp-4); border-radius: 10px; margin-bottom: var(--sp-4); }

/* Atleta */
.at-content { padding: var(--sp-5) var(--sp-4) var(--sp-6); }
.esercizio-card { margin-bottom: var(--sp-3); padding: var(--sp-4); }
.wk-block { margin-bottom: var(--sp-3); }
.wk-ex { gap: var(--sp-3); }
.wk-next { margin-bottom: var(--sp-2); }
@media (min-width: 992px) {
  .at-content { padding: var(--sp-6) var(--sp-6) 3.5rem; }
  .at-cols { column-gap: var(--sp-4); }
}
@media (max-width: 991.98px) {
  .pt-content { padding: var(--sp-4) var(--sp-4) 3rem; }
  .card-pt { padding: var(--sp-4); }
}
@media (max-width: 575.98px) {
  .pt-content { padding: var(--sp-3) var(--sp-3) 3rem; }
  h1 { margin-bottom: var(--sp-4); }
  .card-pt { padding: var(--sp-4); margin-bottom: var(--sp-3); }
}
/* Schede orizzontali: scorrimento senza barra, con sfumatura a destra come indizio */
.tabs-pt { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs-pt::-webkit-scrollbar { display: none; }
.tabs-pt button { flex: none; }
@media (max-width: 575.98px) {
  .scad-blocco { text-align: left !important; width: 100%; padding-top: var(--sp-2); }
  .scad-blocco .btn-group { width: 100%; }
  .scad-blocco .btn-group .btn { flex: 1; }
  .pt-content > .d-flex:first-child { gap: var(--sp-3) !important; }
}

/* Scelta "Invia subito / Più tardi" */
.scelta-invito { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.scelta-invito button { text-align: left; border: 1px solid var(--pt-line); border-radius: 12px; background: var(--pt-card); color: var(--pt-ink); padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-1); }
.scelta-invito button span { font-size: .85rem; color: var(--pt-muted); }
.scelta-invito button.attiva { border-color: var(--pt-accent); background: var(--pt-accent-soft); box-shadow: 0 0 0 1px var(--pt-accent); }
@media (max-width: 575.98px) { .scelta-invito { grid-template-columns: 1fr; } }
.lista-fonti li + li { margin-top: var(--sp-3); }


/* ===== Pagine legali ===== */
.legale-shell { min-height: 100vh; display: flex; flex-direction: column; background: var(--pt-bg); }
.legale-head { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-4); flex-wrap: wrap; padding: var(--sp-4) var(--sp-5); background: var(--pt-grad); color: #fff; }
.legale-head a { color: #fff; text-decoration: none; }
.legale-marchio { font-weight: 700; letter-spacing: .02em; }
.legale-head nav { display: flex; gap: var(--sp-2); }
.legale-head nav a { padding: .35rem .8rem; border-radius: 8px; color: #f3d9dd; }
.legale-head nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.legale-head nav a.active { background: rgba(255,255,255,.2); color: #fff; }
.legale-corpo { flex: 1; width: 100%; max-width: 820px; margin: 0 auto; padding: var(--sp-6) var(--sp-4) 3rem; }
.legale-testo { background: var(--pt-card); border: 1px solid var(--pt-line); border-radius: var(--raggio); padding: var(--sp-6); }
.legale-testo h1 { font-size: 2rem; }
.legale-testo h2 { font-size: 1.15rem; margin: var(--sp-6) 0 var(--sp-3); }
.legale-testo p, .legale-testo li { line-height: 1.65; }
.legale-testo ul { padding-left: 1.2rem; margin-bottom: var(--sp-4); }
.legale-testo li + li { margin-top: var(--sp-2); }
.legale-tabella { --bs-table-bg: transparent; --bs-table-color: var(--pt-ink); --bs-table-border-color: var(--pt-line); margin: var(--sp-3) 0 var(--sp-4); }
.legale-tabella th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--pt-muted); }
.legale-foot { padding: var(--sp-5) var(--sp-4); text-align: center; color: var(--pt-muted); font-size: .9rem; }
.da-compilare { background: var(--pt-warn-soft); color: var(--pt-warn); border-radius: 6px; padding: 0 .35rem; font-weight: 600; }
.account-legal { position: absolute; bottom: var(--sp-4); left: 0; right: 0; display: flex; justify-content: center; gap: var(--sp-4); font-size: .85rem; }
.account-legal a { color: rgba(255,255,255,.8); text-decoration: none; }
.account-legal a:hover { color: #fff; text-decoration: underline; }
.account-shell { position: relative; }
.legali-mini { margin-top: .35rem; }
@media (max-width: 575.98px) { .legale-testo { padding: var(--sp-4); } .legale-corpo { padding: var(--sp-4) var(--sp-3) 2.5rem; } .legale-testo h1 { font-size: 1.7rem; } }


/* ===== Consenso al primo accesso ===== */
.consenso-shell { align-items: flex-start; padding-top: 4vh; padding-bottom: 6rem; }
.consenso-card { max-width: 560px; }
.consenso-sintesi { padding-left: 1.1rem; margin-bottom: var(--sp-4); color: var(--pt-t2); }
.consenso-sintesi li + li { margin-top: var(--sp-2); }
.consenso-scelte { border: 0; padding: 0; margin: 0 0 var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); }
.consenso-voce { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-4); border: 1px solid var(--pt-line); border-radius: 12px; cursor: pointer; line-height: 1.5; font-size: .95rem; }
.consenso-voce.attiva { border-color: var(--pt-accent); background: var(--pt-accent-soft); }
.consenso-voce input { flex: none; width: 1.4rem; height: 1.4rem; margin-top: .15rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Caselle di spunta e marchio nel tema */
.form-check-input { background-color: var(--pt-input); border: 1.5px solid var(--pt-muted); }
.form-check-input:checked { background-color: var(--pt-accent); border-color: var(--pt-accent); }
.form-check-input:focus { border-color: var(--pt-accent); box-shadow: 0 0 0 .2rem rgba(200,16,46,.25); }
:root[data-bs-theme="dark"] .account-card .brand { background: none; color: var(--pt-accent); -webkit-text-fill-color: var(--pt-accent); }


/* ===== Pannello a scorrimento (Aggiungi alimento) ===== */
.sheet-overlay { align-items: flex-end; padding: 0; }
.sheet { background: var(--pt-card); color: var(--pt-ink); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 24px 24px 0 0; padding: var(--sp-2) var(--sp-4) calc(var(--sp-5) + env(safe-area-inset-bottom)); box-shadow: 0 -12px 40px rgba(0,0,0,.35); display: flex; flex-direction: column; gap: var(--sp-3); }
.sheet-maniglia { width: 44px; height: 5px; border-radius: 3px; background: var(--pt-line); margin: var(--sp-2) auto var(--sp-1); }
.sheet-testa { display: flex; align-items: center; gap: var(--sp-3); }
.sheet-testa h2 { margin: 0; font-size: 1.2rem; flex: 1; }
.sheet-titolo { flex: 1; min-width: 0; }
.sheet-titolo h2 { overflow-wrap: anywhere; }
.sheet-conferma { display: flex; align-items: center; gap: var(--sp-2); background: var(--pt-ok-soft); color: var(--pt-ok); border-radius: 12px; padding: var(--sp-3) var(--sp-4); font-weight: 600; font-size: .95rem; }
.sheet-ricerca { display: flex; gap: var(--sp-2); }
.sheet-campo { flex: 1; display: flex; align-items: center; gap: var(--sp-2); height: 52px; border: 2px solid var(--pt-accent); border-radius: 14px; padding: 0 var(--sp-3); color: var(--pt-muted); background: var(--pt-input); }
.sheet-campo input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--pt-ink); font-size: 1rem; }
.icon-btn-scuro { width: 52px; height: 52px; background: var(--pt-ink); color: var(--pt-bg); border: 0; border-radius: 14px; }
.sheet-video { width: 100%; border-radius: 12px; background: #000; }
.sheet-tab { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.sheet-tab button { height: 38px; padding: 0 var(--sp-4); border-radius: 99px; border: 1px solid var(--pt-line); background: var(--pt-card); color: var(--pt-ink); font-weight: 600; font-size: .85rem; display: inline-flex; align-items: center; gap: .35rem; }
.sheet-tab button.attiva { background: var(--pt-ink); color: var(--pt-bg); border-color: var(--pt-ink); }
.sheet-lista { min-height: 80px; }
.riga-alimento { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-1) 0; border-bottom: 1px solid var(--pt-line); }
.riga-alimento:last-child { border-bottom: 0; }
.riga-alimento-corpo { flex: 1; min-width: 0; text-align: left; border: 0; background: transparent; color: var(--pt-ink); padding: var(--sp-2) 0; display: flex; flex-direction: column; gap: 2px; }
.riga-alimento-nome { font-weight: 600; overflow-wrap: anywhere; }
.riga-alimento-rapido { flex: none; min-height: 44px; padding: 0 var(--sp-3); border: 0; border-radius: 12px; background: var(--pt-accent-soft); color: var(--pt-accent); font-weight: 700; font-size: .85rem; white-space: nowrap; }
.sheet-azioni { display: grid; grid-template-columns: 1fr; gap: var(--sp-2); border-top: 1px solid var(--pt-line); padding-top: var(--sp-4); }
.sheet-quantita { display: flex; align-items: center; height: 72px; border: 2px solid var(--pt-accent); border-radius: 18px; padding: 0 var(--sp-4); box-shadow: 0 0 0 4px var(--pt-accent-soft); }
.sheet-quantita input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--pt-ink); font-family: var(--font-display); font-weight: 700; font-size: 44px; }
.sheet-quantita span { font-size: 1.25rem; color: var(--pt-muted); font-weight: 600; }
.sheet-chip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-2); }
.sheet-chip button { height: 48px; border-radius: 12px; border: 1px solid var(--pt-line); background: var(--pt-card); color: var(--pt-ink); font-weight: 700; }
.sheet-chip button.attiva { background: var(--pt-ink); color: var(--pt-bg); border-color: var(--pt-ink); }
.sheet-macro { background: var(--pt-head); border-radius: 16px; padding: var(--sp-4); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-2); text-align: center; }
.sheet-macro b { display: block; font-family: var(--font-display); font-size: 1.6rem; line-height: 1.1; }
.sheet-macro b.m-p { color: var(--pt-accent); }
.sheet-macro span { font-size: .75rem; color: var(--pt-muted); }
@media (min-width: 576px) { .sheet-overlay { align-items: center; padding: var(--sp-4); } .sheet { border-radius: 22px; padding-bottom: var(--sp-5); max-height: 88vh; } .sheet-maniglia { display: none; } .sheet-azioni { grid-template-columns: 1.4fr 1fr 1fr; } }


/* ===== Area PT: aderenza, podio, editor, indice impostazioni ===== */
.aderenza { display: inline-flex; align-items: center; gap: var(--sp-3); }
.aderenza b { font-variant-numeric: tabular-nums; min-width: 2.6ch; text-align: right; }
.mini-bar { display: inline-block; width: 88px; height: 8px; border-radius: 4px; background: var(--pt-line); overflow: hidden; vertical-align: middle; }
.mini-bar > span { display: block; height: 100%; border-radius: 4px; background: var(--pt-grad); }
.table-stack td .aderenza { justify-content: flex-end; }

.podio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); align-items: end; margin-bottom: var(--sp-5); }
.podio-posto { display: flex; flex-direction: column; align-items: center; gap: var(--sp-1); text-decoration: none; color: var(--pt-ink); background: var(--pt-card); border: 1px solid var(--pt-line); border-radius: var(--raggio); padding: var(--sp-4) var(--sp-3); text-align: center; }
.podio-posto:hover { border-color: var(--pt-accent); }
.podio-1 { padding-top: var(--sp-6); padding-bottom: var(--sp-6); background: var(--pt-grad); color: #fff; border-color: transparent; }
.podio-2 { padding-top: var(--sp-5); padding-bottom: var(--sp-5); }
.podio-num { font-family: var(--font-display); font-weight: 800; font-style: italic; font-size: 2rem; line-height: 1; }
.podio-nome { font-weight: 600; overflow-wrap: anywhere; }
.podio-punti { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; line-height: 1; }
.podio-punti small { font-family: var(--font-body); font-weight: 400; font-size: .75rem; opacity: .75; }
@media (max-width: 575.98px) { .podio { gap: var(--sp-2); } .podio-posto { padding: var(--sp-3) var(--sp-2); } .podio-nome { font-size: .85rem; } }

.editor-barra { position: sticky; top: 0; z-index: 30; background: var(--pt-bg); padding: var(--sp-3) 0; margin-bottom: var(--sp-3); border-bottom: 1px solid var(--pt-line); }
.editor-barra h1 { margin-bottom: 0; font-size: 1.6rem; }
.editor-barra h1::after { display: none; }

.indice-sezioni { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 0 0 var(--sp-5); }
.indice-sezioni a { padding: .4rem .9rem; border: 1px solid var(--pt-line); border-radius: 99px; text-decoration: none; color: var(--pt-ink); background: var(--pt-card); font-weight: 600; font-size: .85rem; }
.indice-sezioni a:hover { border-color: var(--pt-accent); color: var(--pt-accent); }
.card-pt > h2[id] { scroll-margin-top: 90px; }

/* Editor: colonne con larghezza minima sensata, scorrimento orizzontale se serve */
@media (min-width: 768px) {
  .scheda-tabella { min-width: 900px; table-layout: auto; }
  .scheda-tabella td.ed-es { min-width: 215px; }
  .scheda-tabella td.ed-ob { min-width: 170px; }
  .scheda-tabella td[data-label="Serie"] { width: 76px; }
  .scheda-tabella td[data-label="Recupero (s)"] { width: 96px; }
  .scheda-tabella td[data-label^="Rip"] { min-width: 124px; }
  .scheda-tabella td[data-label="Jump-set"] { min-width: 118px; }
  .scheda-tabella .sel-btn { white-space: nowrap; }
  .scheda-tabella input.form-control, .scheda-tabella .sel-btn { min-height: 40px; }
}
.sel-btn > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; max-width: 100%; }

/* ===== Home PT (dashboard) ===== */
.home-griglia { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--sp-4); margin-bottom: var(--sp-4); }
.home-griglia > .card-pt { margin-bottom: 0; }
.avviso { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.avviso-testo { flex: 1; min-width: 200px; }
.barre { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--sp-2); align-items: end; height: 150px; }
.barra { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.barra-col { flex: 1; width: 100%; display: flex; align-items: flex-end; background: var(--pt-head); border-radius: 8px; overflow: hidden; }
.barra-col > span { display: block; width: 100%; background: var(--pt-grad); border-radius: 8px 8px 0 0; }
.barra.oggi .barra-g { color: var(--pt-accent); font-weight: 700; }
.barra-n { font-size: .8rem; font-weight: 700; min-height: 1.1em; }
.barra-g { font-size: .72rem; text-transform: capitalize; color: var(--pt-muted); }
.settimana { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--sp-2); }
.giorno { border: 1px solid var(--pt-line); border-radius: 12px; padding: var(--sp-3); min-height: 112px; display: flex; flex-direction: column; gap: var(--sp-2); }
.giorno.oggi { border-color: var(--pt-accent); background: var(--pt-accent-soft); }
.giorno-testa { display: flex; justify-content: space-between; align-items: baseline; font-size: .78rem; text-transform: capitalize; color: var(--pt-muted); }
.giorno-testa b { font-family: var(--font-display); font-size: 1.5rem; color: var(--pt-ink); line-height: 1; }
.evento { background: var(--pt-card); border-left: 3px solid var(--pt-accent); border-radius: 6px; padding: 4px 6px; font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.giorno-vuoto { color: var(--pt-muted); text-align: center; margin: auto; }
.riga-atleta { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--pt-line); text-decoration: none; color: var(--pt-ink); }
.riga-atleta:last-child { border-bottom: 0; }
.riga-atleta:hover .riga-atleta-nome { color: var(--pt-accent); }
.riga-atleta-nome { flex: 1; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.posto { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--pt-grad); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; }
.posto-warn { background: var(--pt-warn-soft); color: var(--pt-warn); }
@media (max-width: 991.98px) {
  .home-griglia { grid-template-columns: 1fr; }
  .settimana { grid-template-columns: 1fr; }
  .giorno { min-height: 0; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .giorno-testa { min-width: 70px; flex-direction: column; align-items: flex-start; gap: 0; }
  .giorno-vuoto { margin: 0 0 0 auto; }
  .barre { height: 120px; }
}

/* ===== Libreria esercizi: griglia con anteprime ===== */
.vista-toggle { display: inline-flex; border: 1px solid var(--pt-line); border-radius: 10px; overflow: hidden; }
.vista-toggle button { border: 0; background: var(--pt-card); color: var(--pt-ink); padding: .5rem 1rem; font-weight: 600; font-size: .85rem; }
.vista-toggle button.attiva { background: var(--pt-ink); color: var(--pt-bg); }
.griglia-esercizi { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-4); }
.es-card { background: var(--pt-card); border: 1px solid var(--pt-line); border-radius: var(--raggio); overflow: hidden; display: flex; flex-direction: column; }
.es-media { position: relative; aspect-ratio: 16 / 10; background: linear-gradient(135deg, color-mix(in srgb, var(--g) 85%, #000), color-mix(in srgb, var(--g) 35%, #000)); display: grid; place-items: center; overflow: hidden; }
.es-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.es-segnaposto { color: rgba(255,255,255,.7); }
.es-play { position: absolute; width: 40px; height: 40px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; }
.es-corpo { padding: var(--sp-4); flex: 1; display: flex; flex-direction: column; gap: var(--sp-1); }
.es-nome { font-size: 1rem; font-weight: 700; margin: 0; line-height: 1.3; }
.es-azioni { padding: 0 var(--sp-4) var(--sp-4); display: flex; gap: var(--sp-2); }

/* ===== Impostazioni: pulsante di sezione ===== */
.card-foot { display: flex; align-items: center; gap: var(--sp-3); margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--pt-line); }


/* rifiniture */
.home-attivita { display: flex; flex-direction: column; }
.home-attivita .barre { flex: 1; min-height: 190px; height: auto; }
.es-media { aspect-ratio: 16 / 7; }
.es-vuoto { display: inline-flex; align-items: center; gap: .4rem; color: rgba(255,255,255,.85); font-size: .8rem; font-weight: 600; letter-spacing: .02em; }
.es-segnaposto { opacity: .9; }

/* rifiniture screenshot */
.grafico { max-width: 760px; max-height: 260px; display: block; }
.scheda-tabella td[data-label="Jump-set"] { min-width: 150px; }
.col-12 > .small-label { margin-top: var(--sp-3); margin-bottom: 0; }
.card-pt p + .row { margin-top: var(--sp-3); }

/* Menu e pulsanti affiancati (input-group) */
.input-group > .sel { flex: 1 1 auto; width: 1%; min-width: 0; }
.input-group > .sel .sel-btn { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group > .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.btn-outline-primary { --bs-btn-disabled-color: var(--pt-accent); --bs-btn-disabled-border-color: var(--pt-accent); --bs-btn-disabled-bg: transparent; }
.btn-outline-primary:disabled, .btn-outline-primary.disabled { opacity: .45; }
.btn-primary:disabled { color: #fff; }

/* Area atleta su schermi larghi: sfrutta lo spazio */
@media (min-width: 992px) { .at-content { max-width: 1640px; } }

/* ===== Logo V-Shape Sostenibile ===== */
.logo { display: block; max-width: 100%; height: auto; }
.pt-brand { padding: .25rem .5rem 1rem; }
.pt-brand .logo { width: 170px; margin: 0 auto; }
.account-card .brand, .consenso-card .brand { background: none; -webkit-text-fill-color: initial; text-align: center; margin-bottom: var(--sp-4); }
.account-card .brand .logo { width: 200px; margin: 0 auto; }
.logo-su-scuro { display: none; }
:root[data-bs-theme="dark"] .logo-su-chiaro { display: none; }
:root[data-bs-theme="dark"] .logo-su-scuro { display: block; }
.pt-brand { background: #fff; border-radius: 14px; padding: var(--sp-3) var(--sp-4); margin: 0 0 var(--sp-5); }
.pt-brand .logo { width: 100%; max-width: 150px; }

/* ===== Home semplificata e calendario ===== */
.grid-stat-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.home-griglia-pari { grid-template-columns: 1fr 1fr; }
.cal-testa { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.cal-testa .vista-toggle { margin-left: auto; }
.cal-nav { display: inline-flex; gap: var(--sp-1); }
.cal-titolo { text-transform: capitalize; font-weight: 700; font-size: 1.05rem; margin: var(--sp-3) 0; }
.cal-griglia { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--sp-1); }
.cal-giorno-nome { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--pt-muted); padding: 0 var(--sp-1); }
.cal-cella { border: 1px solid var(--pt-line); border-radius: 10px; padding: var(--sp-2); display: flex; flex-direction: column; gap: 4px; overflow: hidden; }
.cal-mese .cal-cella { min-height: 96px; }
.cal-settimana .cal-cella { min-height: 160px; }
.cal-cella.oggi { border-color: var(--pt-accent); background: var(--pt-accent-soft); }
.cal-cella.fuori { opacity: .45; }
.cal-num { font-family: var(--font-display); font-size: 1.2rem; line-height: 1; color: var(--pt-ink); }
.cal-gs { display: none; margin-left: 6px; font-family: var(--font-body); font-size: .75rem; text-transform: capitalize; color: var(--pt-muted); }
.cal-ev { display: block; border-left: 3px solid var(--pt-accent); background: var(--pt-card); border-radius: 6px; padding: 2px 6px; font-size: .75rem; color: var(--pt-ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ev.cal-app { border-left-color: #1d5fa8; }
.cal-ev:hover { background: var(--pt-head); }
.cal-punti { display: none; gap: 3px; }
.cal-punti i { width: 6px; height: 6px; border-radius: 50%; background: var(--pt-accent); display: block; }
.cal-agenda { margin-top: var(--sp-4); border-top: 1px solid var(--pt-line); padding-top: var(--sp-3); }
.cal-riga { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) 0; text-decoration: none; color: var(--pt-ink); flex-wrap: wrap; }
.cal-riga:hover .cal-riga-testo { color: var(--pt-accent); }
.cal-riga-data { width: 96px; flex: none; text-transform: capitalize; color: var(--pt-muted); font-size: .85rem; }
.cal-riga-testo { flex: 1; min-width: 160px; font-weight: 600; }
@media (max-width: 767.98px) {
  .home-griglia-pari { grid-template-columns: 1fr; }
  .cal-giorno-nome { text-align: center; padding: 0; }
  .cal-mese .cal-cella { min-height: 52px; padding: 4px; align-items: center; }
  .cal-mese .cal-ev { display: none; }
  .cal-mese .cal-punti { display: flex; }
  .cal-settimana { grid-template-columns: 1fr; }
  .cal-settimana .cal-giorno-nome { display: none; }
  .cal-settimana .cal-cella { min-height: 0; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .cal-settimana .cal-gs { display: inline; }
  .cal-settimana .cal-num { min-width: 80px; }
}

/* ===== Confronto allenamenti ===== */
.confronto { overflow-x: auto; border: 1px solid var(--pt-line); border-radius: 12px; }
.confronto table { min-width: 640px; }
.confronto th, .confronto td { padding: var(--sp-2) var(--sp-3); vertical-align: top; }
.conf-cella { min-width: 120px; }
.conf-serie { word-spacing: .1em; }
.conf-es { position: sticky; left: 0; background: var(--pt-card); z-index: 1; min-width: 180px; white-space: normal !important; box-shadow: 1px 0 0 var(--pt-line); }
.conf-serie { font-size: .85rem; }
.conf-delta { display: inline-flex; align-items: center; gap: 3px; font-size: .78rem; font-weight: 700; color: var(--pt-muted); }
.conf-delta.su { color: #0f7a3d; }
.conf-delta.giu { color: #c8102e; }

/* ===== Questionario check ===== */
.scala10 { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: var(--sp-1); }
.scala10 button { border: 1px solid var(--pt-line); background: var(--pt-card); color: var(--pt-ink); border-radius: 10px; min-height: 44px; font-weight: 700; }
.scala10 button.attiva { background: var(--pt-grad); color: #fff; border-color: transparent; }
.scala10 button:disabled { opacity: .6; }
.scala10-etichette { display: flex; justify-content: space-between; font-size: .75rem; color: var(--pt-muted); margin-top: var(--sp-1); }
fieldset:disabled .card-pt { opacity: .85; }
.card-azione { border-color: var(--pt-accent); }
.risposte { display: grid; gap: var(--sp-2); margin: 0; }
.risposta { display: grid; grid-template-columns: minmax(160px, 260px) 1fr; gap: var(--sp-3); padding: var(--sp-2) 0; border-bottom: 1px solid var(--pt-line); }
.risposta:last-child { border-bottom: 0; }
.risposta dt { font-weight: 600; color: var(--pt-muted); font-size: .88rem; }
.risposta dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 575.98px) {
  .scala10 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .risposta { grid-template-columns: 1fr; gap: 2px; }
}


/* ===== Pannello "Aggiungi alimento" (v2): testata e piede fissi, corpo scorrevole ===== */
.sheet { display: flex; flex-direction: column; gap: 0; overflow: hidden; height: min(92vh, 760px); padding: var(--sp-2) 0 0; }
.sheet > * { flex: none; }
.sheet-fisso { padding: var(--sp-2) var(--sp-4) var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-3); }
.sheet-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 var(--sp-4) var(--sp-4); overscroll-behavior: contain; }
.sheet-piede { padding: var(--sp-3) var(--sp-4) calc(var(--sp-4) + env(safe-area-inset-bottom)); border-top: 1px solid var(--pt-line); display: flex; flex-direction: column; gap: var(--sp-3); background: var(--pt-card); }
.sheet-titolo h2 { font-size: 1.25rem; line-height: 1.2; }
.sheet-campo { position: relative; }
.sheet-svuota { border: 0; background: var(--pt-head); color: var(--pt-muted); width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.sheet-risultati-testa { padding: 0 var(--sp-1); }
.sheet-vuoto { text-align: center; color: var(--pt-muted); padding: var(--sp-6) var(--sp-4); display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); }
.sheet-vuoto p { margin: 0; }
.sheet-conferma { margin: 0; }
.sheet-strumenti { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }
.sheet-strumenti button { min-height: 52px; border: 1px solid var(--pt-line); background: var(--pt-card); color: var(--pt-ink); border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .78rem; font-weight: 600; padding: var(--sp-2); }
.sheet-strumenti button[aria-expanded="true"] { border-color: var(--pt-accent); color: var(--pt-accent); }
.sheet-strumenti button:disabled { opacity: .45; }
.sheet-codice { flex-wrap: nowrap; }
/* righe */
.riga-alimento { padding: var(--sp-2) 0; gap: var(--sp-3); align-items: center; }
.riga-alimento-corpo { gap: 4px; padding: var(--sp-1) 0; }
.riga-alimento-sotto { font-size: .8rem; color: var(--pt-muted); }
.macro-chip { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: .78rem; color: var(--pt-muted); }
.mc { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--pt-ink); }
.mc i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.mc-p i { background: var(--pt-accent); } .mc-c i { background: #d89a1f; } .mc-g i { background: #6b7a90; }
.mc-per { color: var(--pt-muted); }
.riga-alimento-rapido { display: inline-flex; align-items: center; gap: 4px; min-width: 88px; justify-content: center; min-height: 44px; border-radius: 22px; }
.riga-alimento-rapido:active { transform: scale(.96); }
/* quantità */
.sheet-quantita { height: 76px; padding: 0 var(--sp-2); gap: var(--sp-2); justify-content: space-between; }
.q-valore { flex: 1; display: flex; align-items: baseline; justify-content: center; gap: 6px; min-width: 0; }
.q-valore input { width: 5ch; flex: 0 1 auto; text-align: right; }
.q-passo { width: 52px; height: 52px; border-radius: 14px; border: 1px solid var(--pt-line); background: var(--pt-head); color: var(--pt-ink); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.q-passo:active { background: var(--pt-accent-soft); color: var(--pt-accent); }
.sheet-quantita + .sheet-chip { margin-top: var(--sp-3); }
.sheet-chip + .sheet-macro { margin-top: var(--sp-4); }
.sheet-macro { grid-template-columns: 1.15fr 1fr 1fr 1fr; align-items: end; }
.sheet-macro .sm-kcal b { color: var(--pt-ink); }
.sheet-macro small { font-size: .7rem; font-weight: 600; color: var(--pt-muted); font-family: var(--font-body); }
@media (min-width: 576px) { .sheet { height: min(88vh, 720px); padding-top: var(--sp-3); } }

.sheet-nota { display: flex; gap: var(--sp-2); align-items: flex-start; background: var(--pt-warn-soft); color: var(--pt-warn); border-radius: 12px; padding: var(--sp-3); font-size: .85rem; line-height: 1.4; }
.sheet-nota svg { flex: none; margin-top: 2px; }

/* ===== Scanner codice a barre ===== */
.scanner { position: relative; width: 100%; aspect-ratio: 1 / 1; max-height: 40vh; border-radius: 18px; overflow: hidden; background: #000; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner-mirino { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; background: radial-gradient(ellipse 80% 24% at 50% 50%, transparent 60%, rgba(0,0,0,.45) 100%); }
.scanner-mirino > span { position: relative; width: 82%; height: 26%; border-radius: 14px; border: 2px solid rgba(255,255,255,.9); box-shadow: 0 0 0 9999px rgba(0,0,0,.35); }
.scanner-mirino > span::after { content: ""; position: absolute; left: 6%; right: 6%; top: 50%; height: 2px; background: var(--pt-accent); box-shadow: 0 0 8px var(--pt-accent); animation: scanner-linea 1.8s ease-in-out infinite; }
@keyframes scanner-linea { 0%, 100% { transform: translateY(-34px); opacity: .4; } 50% { transform: translateY(34px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .scanner-mirino > span::after { animation: none; } }
