:root {
  --navy: #0e2a3b;
  --navy-2: #163b52;
  --green: #1d7a4a;
  --green-soft: #e3f3ea;
  --ball: #d9f24a;
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #15232d;
  --muted: #6a7883;
  --line: #e3e8ec;
  --danger: #c0392b;
  --amber: #b7791f;
  --amber-soft: #fdf3e1;
  --grey-soft: #eef1f4;
  --c-tecnico: #1f6fb2;
  --c-tattico: #7b4bc2;
  --c-mentale: #c2477b;
  --c-fisico: #c26a1f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(14, 42, 59, .06), 0 4px 14px rgba(14, 42, 59, .05);
  font-family: "Segoe UI", Inter, system-ui, -apple-system, Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.pre { white-space: pre-wrap; line-height: 1.5; }

/* ── Boot / logo ───────────────────────────── */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--muted); }
.logo { width: 38px; height: 38px; border-radius: 11px; background: var(--ball); color: var(--navy); display: grid; place-items: center; font-weight: 800; font-size: .95rem; flex: none; box-shadow: inset 0 0 0 2px rgba(14,42,59,.12); }
.logo.lg { width: 64px; height: 64px; border-radius: 18px; font-size: 1.4rem; }

/* ── Layout ────────────────────────────────── */
.layout { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: var(--navy); color: #dbe6ee; display: flex; flex-direction: column; padding: 22px 14px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 22px; }
.brand-name { font-weight: 700; color: #fff; line-height: 1.1; }
.brand-sub { font-size: .8rem; color: #9fb6c6; letter-spacing: .04em; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #c5d4df; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: rgba(217, 242, 74, .14); color: #fff; }
.nav a.active svg { color: var(--ball); }
.nav .badge { margin-left: auto; }
.side-foot { margin-top: auto; display: grid; gap: 8px; padding: 12px 8px 0; border-top: 1px solid rgba(255,255,255,.08); }
.side-foot .muted { color: #8ea6b7; word-break: break-all; }
.side-foot .btn-link { color: #c5d4df; justify-self: start; }
.demo-tag { font-size: .75rem; font-weight: 600; color: var(--navy); background: var(--ball); border-radius: 999px; padding: 3px 10px; justify-self: start; }
.main { min-width: 0; }
.topbar { display: none; }
.view { max-width: 1100px; margin: 0 auto; padding: 28px 28px 110px; }
.tabbar { display: none; }
.mobile-only { display: none; }
svg.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 899px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .mobile-only { display: flex; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); }
  .topbar .brand { padding: 0; flex: 1; gap: 10px; }
  .topbar .logo { width: 32px; height: 32px; font-size: .8rem; }
  .topbar .icon-btn { color: #dbe6ee; }
  .view { padding: 18px 14px 110px; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: #fff; border-top: 1px solid var(--line); padding: 6px 4px max(6px, env(safe-area-inset-bottom)); justify-content: space-around; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .68rem; color: var(--muted); padding: 4px 6px; border-radius: 8px; position: relative; min-width: 58px; }
  .tabbar a.active { color: var(--navy); font-weight: 600; }
  .tabbar a.active svg { color: var(--green); }
  .tabbar .badge { position: absolute; top: 0; right: 10px; }
  h1 { font-size: 1.35rem; }
}

/* ── Componenti base ──────────────────────── */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }
.card.pad { padding: 18px; }
.section { margin-top: 26px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .9rem; margin-bottom: 10px; }
.back:hover { color: var(--text); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: #fff; padding: 9px 16px; border-radius: 10px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #c9d2d9; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: #18683f; }
.btn.dark { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.ghost { background: transparent; }
.sidebar .btn.ghost { color: #dbe6ee; border-color: rgba(255,255,255,.15); }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 6px 12px; font-size: .88rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }
.btn-link { background: none; border: 0; padding: 0; color: var(--green); font-weight: 600; cursor: pointer; font-size: .9rem; }
.btn-link.danger { color: var(--danger); }
.icon-btn { background: none; border: 0; width: 34px; height: 34px; border-radius: 9px; display: inline-grid; place-items: center; cursor: pointer; color: var(--muted); font-size: 1.2rem; line-height: 1; }
.icon-btn:hover { background: var(--grey-soft); color: var(--text); }
.icon-btn.sm { width: 26px; height: 26px; font-size: 1rem; }
.badge { background: var(--danger); color: #fff; border-radius: 999px; font-size: .7rem; font-weight: 700; padding: 1px 7px; min-width: 18px; text-align: center; }
.badge:empty { display: none; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px; font-size: .85rem; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
span.chip { cursor: default; }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.chip.soft { background: var(--grey-soft); border-color: transparent; }
.chip.add { border-style: dashed; color: var(--green); font-weight: 600; }
.chip.sel { background: var(--green-soft); border-color: var(--green); color: var(--green); font-weight: 600; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.cat-tecnico { --c: var(--c-tecnico); }
.cat-tattico { --c: var(--c-tattico); }
.cat-mentale { --c: var(--c-mentale); }
.cat-fisico { --c: var(--c-fisico); }
.chip[class*="cat-"] .dot { background: var(--c); }

.tag { display: inline-flex; align-items: center; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 3px 8px; border-radius: 6px; background: var(--grey-soft); color: var(--muted); white-space: nowrap; }
.tag.privata, .tag.privato { background: #e8f0fa; color: var(--c-tecnico); }
.tag.gruppo, .tag.corso { background: var(--green-soft); color: var(--green); }
.tag.minore { background: var(--amber-soft); color: var(--amber); }
.tag.entrambi { background: #f0e9fa; color: var(--c-tattico); }

.pill { border: 0; border-radius: 999px; padding: 4px 11px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
button.pill { cursor: pointer; }
.st-da_iniziare { background: var(--grey-soft); color: var(--muted); }
.st-in_corso { background: var(--amber-soft); color: var(--amber); }
.st-raggiunto { background: var(--green-soft); color: var(--green); }

.progress { height: 8px; border-radius: 99px; background: var(--grey-soft); overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--green), #35a86a); border-radius: inherit; transition: width .3s; }
.progress.sm { height: 5px; width: 80px; }

.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--navy-2); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; letter-spacing: .02em; }
.avatar.lg { width: 64px; height: 64px; font-size: 1.3rem; background: var(--ball); color: var(--navy); }
.avatar.sm { width: 32px; height: 32px; font-size: .75rem; }

.empty { padding: 34px 18px; text-align: center; color: var(--muted); }

/* ── KPI ──────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi { padding: 16px 18px; }
.kpi .v { font-size: 1.8rem; font-weight: 800; color: var(--navy); line-height: 1.1; }
.kpi .l { color: var(--muted); font-size: .85rem; margin-top: 4px; }
@media (max-width: 899px) { .kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; } .kpi .v { font-size: 1.5rem; } }

/* ── Liste ────────────────────────────────── */
.list { overflow: hidden; }
.row { display: flex; align-items: center; gap: 14px; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
a.row:hover { background: #fafbfc; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; }
.row-sub { color: var(--muted); font-size: .85rem; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-side { display: flex; align-items: center; gap: 10px; flex: none; }
@media (max-width: 600px) { .row-side .progress { display: none; } .row { padding: 12px 14px; } }

.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.search { flex: 1 1 260px; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 14px; }
.search:focus { outline: 2px solid rgba(29,122,74,.25); border-color: var(--green); }

/* ── Form ─────────────────────────────────── */
.form { display: grid; gap: 14px; }
.form.grid2 { grid-template-columns: 1fr 1fr; }
.form.grid3 { grid-template-columns: repeat(3, 1fr); }
.form .span2 { grid-column: span 2; }
.form .span3 { grid-column: 1 / -1; }
@media (max-width: 600px) { .form.grid2, .form.grid3 { grid-template-columns: 1fr; } .form .span2 { grid-column: auto; } }
label { display: block; font-size: .85rem; font-weight: 600; color: #3a4a55; }
label > input:not([type=checkbox]), label > select, label > textarea { display: block; margin-top: 6px; }
.form { align-items: end; }
label.check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
input:not([type=checkbox]):not([type=radio]), select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; font-weight: 400; font-size: .95rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(29,122,74,.25); border-color: var(--green); }
textarea { resize: vertical; min-height: 70px; line-height: 1.45; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--green); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.field-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
.lock { font-size: .7rem; background: var(--grey-soft); color: var(--muted); padding: 2px 7px; border-radius: 6px; font-weight: 600; text-transform: none; letter-spacing: 0; }
.seg { display: inline-flex; background: var(--grey-soft); border-radius: 11px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: none; padding: 8px 18px; border-radius: 8px; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg button.on { background: #fff; color: var(--navy); box-shadow: var(--shadow); }
.hint { font-size: .82rem; color: var(--muted); font-weight: 400; }

/* ── Modale ───────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(14, 42, 59, .45); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { background: #fff; border-radius: 18px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { width: min(760px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 10px; position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-body { padding: 8px 20px 20px; }
@media (max-width: 600px) { .modal-backdrop { place-items: end center; padding: 0; } .modal { border-radius: 18px 18px 0 0; max-height: 92vh; } }
@keyframes fade { from { opacity: 0; } }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 12px; z-index: 200; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,.2); animation: fade .2s; max-width: calc(100vw - 32px); }
.toast.err { background: var(--danger); }

/* ── Dashboard ────────────────────────────── */
.hello { margin-bottom: 20px; }
.hello .date { color: var(--muted); text-transform: capitalize; }
.today-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.slot { padding: 14px 16px; display: grid; gap: 8px; }
.slot-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.slot-time { font-size: 1.15rem; font-weight: 800; color: var(--navy); }
.slot-names { font-size: .85rem; color: var(--muted); line-height: 1.4; }
.slot.done { border-color: #b9dfc8; background: #f7fcf9; }
.done-mark { color: var(--green); font-weight: 700; font-size: .85rem; }
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
@media (max-width: 899px) { .two-col { grid-template-columns: 1fr; } }
.callout { padding: 18px; background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; border: 0; display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.callout p { color: #b9cad6; font-size: .9rem; margin-top: 4px; }

/* ── Scheda allievo ───────────────────────── */
.profile { padding: 20px; display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.profile-main { flex: 1; min-width: 200px; }
.profile-main h1 { margin-bottom: 6px; }
.profile-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.profile-stats { display: flex; gap: 22px; }
.profile-stats div { text-align: center; }
.profile-stats b { display: block; font-size: 1.4rem; color: var(--navy); }
.profile-stats span { font-size: .78rem; color: var(--muted); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 22px 0 18px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs a { padding: 10px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--navy); border-color: var(--green); }

.cat-section { margin-bottom: 26px; }
.cat-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cat-head .bar { width: 4px; height: 20px; border-radius: 4px; background: var(--c); }
.cat-head h2 { flex: 1; }
.goals-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
@media (max-width: 600px) { .goals-grid { grid-template-columns: 1fr; } }
.goal { padding: 16px; border-left: 4px solid var(--c, var(--line)); display: grid; gap: 10px; align-content: start; }
.goal-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.goal-title { font-weight: 700; font-size: 1rem; }
.goal.raggiunto .goal-title::after { content: " ✓"; color: var(--green); }
.goal-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.micro-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.micro { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: .92rem; }
.micro-title { flex: 1; }
.micro.raggiunto .micro-title { color: var(--muted); }
.micro .icon-btn { opacity: 0; }
.micro:hover .icon-btn { opacity: 1; }
@media (hover: none) { .micro .icon-btn { opacity: .5; } }
.mc { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #c3ccd3; display: grid; place-items: center; flex: none; background: #fff; padding: 0; }
button.mc { cursor: pointer; }
.mc.in_corso { border-color: var(--amber); background: conic-gradient(var(--amber) 0 50%, #fff 50% 100%); }
.mc.raggiunto { border-color: var(--green); background: var(--green); }
.mc.raggiunto::after { content: ""; width: 6px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.micro-add input { border: 1px dashed var(--line) !important; padding: 7px 10px !important; font-size: .88rem !important; background: #fafbfc !important; }
.goal-actions { display: flex; gap: 16px; padding-top: 4px; border-top: 1px solid var(--line); padding-top: 10px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .mc { width: 16px; height: 16px; }
.legend .mc.raggiunto::after { width: 4px; height: 7px; }

/* ── Timeline lezioni ─────────────────────── */
.timeline { display: grid; gap: 14px; position: relative; }
.tl-card { padding: 16px 18px; display: grid; gap: 12px; }
.tl-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.tl-date { font-size: .82rem; color: var(--muted); text-transform: capitalize; }
.tl-title { font-weight: 700; font-size: 1.02rem; margin-top: 2px; }
.tl-item.absent .tl-card { opacity: .6; }
.comment { margin: 0; padding: 12px 14px; background: var(--green-soft); border-radius: 10px; border-left: 3px solid var(--green); line-height: 1.45; }
.comment::before { content: "Il maestro: "; font-weight: 700; color: var(--green); }
.private { padding: 10px 12px; background: var(--grey-soft); border-radius: 10px; font-size: .9rem; color: #4b5a64; }
.stars { color: #e0b100; letter-spacing: 2px; font-size: 1.05rem; }
.stars .off { color: #d6dde2; }
.month { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }

/* ── Editor lezione ───────────────────────── */
.part { padding: 14px 16px; border-bottom: 1px solid var(--line); display: grid; gap: 12px; }
.part:last-child { border-bottom: 0; }
.part-head { display: flex; align-items: center; gap: 12px; }
.part-name { flex: 1; font-weight: 700; }
.part.absent .part-name { color: var(--muted); text-decoration: line-through; }
.part-body { display: grid; gap: 12px; padding-left: 44px; }
@media (max-width: 600px) { .part-body { padding-left: 0; } }
.micro-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 10px; background: #fafbfc; border-radius: 10px; }
.star-input button { background: none; border: 0; font-size: 1.5rem; cursor: pointer; color: #d6dde2; padding: 0 2px; line-height: 1; }
.star-input button.on { color: #e0b100; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: .85rem; cursor: pointer; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 20px 0 10px; display: flex; justify-content: flex-end; gap: 10px; z-index: 5; }
@media (max-width: 899px) { .sticky-actions { bottom: 62px; } }
.add-part { padding: 12px 16px; border-top: 1px solid var(--line); background: #fafbfc; display: flex; gap: 10px; align-items: center; border-radius: 0 0 var(--radius) var(--radius); }
.add-part select { flex: 1; }

/* ── Gruppi ───────────────────────────────── */
.days { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; align-items: start; }
.day h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; }
.group-card { display: block; padding: 12px 14px; margin-bottom: 10px; }
.group-card:hover { border-color: #c9d2d9; }
.group-card .slot-names { margin-top: 6px; }

/* ── Area allievo ─────────────────────────── */
.hero { padding: 22px; background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 70%, #1d5a4a 100%); color: #fff; border: 0; display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.hero h1 { color: #fff; }
.hero p { color: #b9cad6; margin-top: 4px; }
.hero-main { flex: 1; min-width: 200px; }
.ring { --p: 0; width: 110px; height: 110px; border-radius: 50%; background: conic-gradient(var(--ball) calc(var(--p) * 1%), rgba(255,255,255,.12) 0); display: grid; place-items: center; flex: none; }
.ring > div { width: 86px; height: 86px; border-radius: 50%; background: var(--navy); display: grid; place-content: center; text-align: center; }
.ring b { font-size: 1.5rem; color: #fff; }
.ring span { font-size: .68rem; color: #b9cad6; text-transform: uppercase; letter-spacing: .05em; }
.cat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 899px) { .cat-cards { grid-template-columns: repeat(2, 1fr); } }
.cat-card { padding: 14px 16px; border-top: 4px solid var(--c); display: grid; gap: 8px; }
.cat-card .n { font-size: 1.4rem; font-weight: 800; color: var(--navy); }
.cat-card .n small { font-size: .85rem; color: var(--muted); font-weight: 600; }
.next-micro { font-size: .88rem; color: var(--muted); }
.next-micro b { color: var(--text); font-weight: 600; }
.student-switch { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }

/* ── Lavagna campo ────────────────────────── */
.court-thumbs { display: flex; gap: 14px; flex-wrap: wrap; }
.court-card { width: 128px; display: grid; gap: 6px; position: relative; }
.court-card canvas { width: 128px; height: auto; border-radius: 10px; box-shadow: var(--shadow); cursor: pointer; display: block; }
.court-card .t { font-size: .82rem; font-weight: 600; line-height: 1.25; }
.court-card .icon-btn { position: absolute; top: 4px; right: 4px; background: rgba(255,255,255,.9); }
.court-new { width: 128px; aspect-ratio: 600 / 1194; border: 2px dashed #c5cfd6; border-radius: 10px; background: #fafbfc; display: grid; place-content: center; text-align: center; gap: 6px; color: var(--green); font-weight: 700; cursor: pointer; font-size: .85rem; padding: 8px; }
.court-new span { font-size: 2rem; line-height: 1; }
.board-overlay { position: fixed; inset: 0; z-index: 150; background: #0b2230; display: grid; place-items: center; animation: fade .15s; }
.board { display: grid; grid-template-columns: auto 320px; gap: 20px; height: 100vh; padding: 16px; max-width: 100vw; }
.board-stage { display: grid; place-items: center; min-height: 0; }
.board-stage canvas { max-height: calc(100vh - 32px); max-width: 100%; width: auto; height: auto; border-radius: 12px; touch-action: none; box-shadow: 0 10px 40px rgba(0,0,0,.4); cursor: crosshair; }
.board-side { background: #fff; border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 16px; overflow: auto; align-self: start; max-height: calc(100vh - 32px); }
.bp { display: flex; flex-direction: column; gap: 10px; }
.board-row { align-items: center; justify-content: space-between; }
.board-head { display: flex; gap: 8px; align-items: center; }
.board-head h3 { flex: 1; }
.board-title { flex: 1; font-weight: 600 !important; }
.board-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.board-tools button { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 4px; cursor: pointer; display: grid; gap: 2px; justify-items: center; }
.board-tools button span { font-size: 1.25rem; line-height: 1; }
.board-tools button small { font-size: .68rem; color: var(--muted); line-height: 1.15; text-align: center; }
.board-tools button.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.board-tools button.on small { color: #cfe0ea; }
.board-colors { display: flex; gap: 8px; }
.board-colors button { width: 34px; height: 34px; border-radius: 50%; border: 2px solid #ccd5db; cursor: pointer; }
.board-colors button.on { outline: 3px solid var(--green); outline-offset: 2px; }
.board-surface button { padding: 6px 10px; font-size: .82rem; }
.board-row { display: flex; gap: 8px; flex-wrap: wrap; }
.board-row.end { justify-content: flex-end; margin-top: 4px; }
.board-note-ro { color: var(--text); }
@media (max-width: 899px) {
  .board { grid-template-columns: 1fr; grid-template-rows: auto auto; height: auto; max-height: 100vh; overflow: auto; padding: 10px; gap: 10px; align-content: start; }
  .board-overlay { place-items: start center; overflow: auto; }
  .board-stage canvas { max-height: 58vh; }
  .board-side { display: contents; }
  .bp { background: #fff; border-radius: 14px; padding: 12px; }
  .bp-top { order: 1; }
  .board-stage { order: 2; }
  .bp-bottom { order: 3; }
  .board-tools { grid-template-columns: repeat(6, 1fr); }
  .board-tools button small { display: none; }
}

/* ── Login ────────────────────────────────── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 20% 10%, #1d5a4a 0, transparent 45%), linear-gradient(160deg, var(--navy), #0a1f2c); }
.login-card { width: min(440px, 100%); padding: 30px 28px; display: grid; gap: 18px; }
.login-brand { display: flex; align-items: center; gap: 14px; }
.login-brand h1 { font-size: 1.25rem; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.demo-box { background: #fbfde9; border: 1px solid #e7f0a6; border-radius: 12px; padding: 14px; display: grid; gap: 10px; font-size: .9rem; }

/* ── Loghi nella pagina di accesso ── */
.login-logos { display: flex; align-items: center; justify-content: center; gap: 22px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.login-logos img { display: block; height: auto; object-fit: contain; }
.login-logos .lg-mmta { width: 118px; }
.login-logos .lg-tnl { width: 150px; }
.login-title { text-align: center; }
.login-title h1 { font-size: 1.3rem; }
.login-title p { margin-top: 4px; }

/* ── Lezioni: obiettivi per categoria, valutazione, note dell'allievo ── */
.worked { display: grid; gap: 8px; }
.worked-row { display: flex; gap: 10px; align-items: flex-start; }
.worked-cat { flex: 0 0 64px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding-top: 6px; }
.rating-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.student-note { padding: 10px 12px; background: #fff8e1; border-left: 3px solid #e0b100; border-radius: 10px; font-size: .92rem; white-space: pre-wrap; }
.my-note { display: grid; gap: 8px; padding-top: 12px; border-top: 1px dashed var(--line); }
.my-note textarea { min-height: 58px; }
.my-note-actions { display: flex; justify-content: flex-end; }

/* ── I miei risultati ── */
.matches { display: grid; gap: 14px; }
.match { padding: 16px 18px; display: grid; gap: 12px; border-left: 4px solid var(--line); }
.match.vinta { border-left-color: var(--green); }
.match.persa { border-left-color: var(--danger); }
.match-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.match-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tag.torneo { background: #fdf0e6; color: #b3541e; }
.match-main { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.match-vs { font-weight: 700; font-size: 1.05rem; }
.match-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .match-two { grid-template-columns: 1fr; } }
.score { display: flex; gap: 6px; font-variant-numeric: tabular-nums; }
.score span { font-weight: 800; font-size: 1.05rem; padding: 5px 9px; border-radius: 8px; background: var(--grey-soft); }
.score span.won { background: var(--green-soft); color: var(--green); }
.score span.lost { background: #fbeaea; color: var(--danger); }
.score.sm { font-weight: 700; font-size: .9rem; white-space: nowrap; }
.res-pill { font-size: .78rem; font-weight: 800; padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
.res-pill.vinta { background: var(--green); color: #fff; }
.res-pill.persa { background: #fbeaea; color: var(--danger); }
.res-badge { flex: 0 0 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--grey-soft); color: var(--muted); }
.res-badge.vinta { background: var(--green); color: #fff; }
.res-badge.persa { background: #fbeaea; color: var(--danger); }
.kpi .v small { font-size: .7em; }
.score-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 600px) { .score-grid { grid-template-columns: 1fr; } }
.set-in { display: flex; align-items: center; gap: 6px; background: var(--grey-soft); border-radius: 10px; padding: 8px 10px; }
.set-in span { font-size: .78rem; font-weight: 700; color: var(--muted); flex: 1; }
.set-in input { width: 52px; text-align: center; font-weight: 700; font-size: 1.05rem; padding: 8px 4px; }
.form .seg { display: flex; }
.form .seg button { flex: 1; }

/* Barra in basso: spazio sufficiente per 4 voci con nomi lunghi */
@media (max-width: 899px) { .tabbar a { min-width: 0; flex: 1; text-align: center; line-height: 1.15; } }

/* ── Accesso con password ── */
.form-error { color: var(--danger); font-size: .88rem; background: #fbeaea; padding: 8px 10px; border-radius: 8px; }

/* ── Home dell'allievo: "campo" a croce con il giocatore al centro ── */
.hub-hello { text-align: center; margin-bottom: 14px; }
.hub-hello h1 { font-size: 1.5rem; margin: 2px 0; }
.hub { position: relative; display: grid; grid-template-columns: 1fr 1.15fr 1fr; grid-template-areas: ". top ." "left center right" ". bottom ."; gap: 12px; align-items: center; justify-items: stretch;
  padding: 18px 14px; border-radius: 20px; max-width: 620px; margin: 0 auto;
  background: linear-gradient(160deg, #1d7a4a, #145c37); box-shadow: var(--shadow); overflow: hidden; }
/* linee del campo */
.hub::before, .hub::after { content: ""; position: absolute; background: rgba(255,255,255,.35); pointer-events: none; }
.hub::before { left: 50%; top: 10px; bottom: 10px; width: 2px; transform: translateX(-50%); }
.hub::after { top: 50%; left: 10px; right: 10px; height: 2px; transform: translateY(-50%); }
.hub-card { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; background: #fff; border-radius: 14px; padding: 12px 8px; color: var(--navy); text-decoration: none; box-shadow: 0 4px 14px rgba(0,0,0,.18); transition: transform .12s; }
.hub-card:active { transform: scale(.97); }
@media (hover: hover) { .hub-card:hover { transform: translateY(-2px); } }
.hub-card svg { width: 22px; height: 22px; color: var(--green); }
.hub-t { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); line-height: 1.15; }
.hub-card b { font-size: 1.45rem; line-height: 1.1; white-space: nowrap; }
.hub-s { font-size: .72rem; color: var(--muted); line-height: 1.2; }
.hub-top { grid-area: top; } .hub-left { grid-area: left; } .hub-right { grid-area: right; } .hub-bottom { grid-area: bottom; }
.hub-left svg { color: #c77700; } .hub-right svg { color: var(--green); } .hub-bottom svg { color: #b3541e; }
.hub-center { grid-area: center; position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.hub-ring { width: 132px; height: 132px; border-radius: 50%; padding: 7px; background: conic-gradient(var(--ball, #d9f24a) calc(var(--p) * 1%), rgba(255,255,255,.25) 0); }
.hub-player { width: 100%; height: 100%; border-radius: 50%; background: radial-gradient(circle at 50% 35%, #183f57, #0e2a3b); display: grid; place-items: center; }
.hub-player svg { width: 78%; height: 78%; }
.hub-pct { color: #fff; font-weight: 700; font-size: .85rem; background: rgba(0,0,0,.25); padding: 3px 10px; border-radius: 999px; }
@media (max-width: 420px) {
  .hub { gap: 8px; padding: 14px 8px; grid-template-columns: 1fr 1.05fr 1fr; }
  .hub-ring { width: 112px; height: 112px; }
  .hub-card { padding: 10px 4px; }
  .hub-card b { font-size: 1.25rem; }
}

/* ── Obiettivi della lezione (tecnico / tattico / mentale) ── */
.worked-body { flex: 1; display: grid; gap: 6px; min-width: 0; }
.worked-text { font-weight: 600; line-height: 1.35; padding-top: 4px; }
.worked-row { padding: 8px 10px; border-radius: 10px; background: var(--grey-soft); border-left: 3px solid var(--line); }
.worked-row.cat-tecnico { border-left-color: var(--c-tecnico); }
.worked-row.cat-tattico { border-left-color: var(--c-tattico); }
.worked-row.cat-mentale { border-left-color: var(--c-mentale); }
.worked-row.cat-fisico { border-left-color: var(--c-fisico); }
.worked-row.cat-tecnico .worked-cat { color: var(--c-tecnico); }
.worked-row.cat-tattico .worked-cat { color: var(--c-tattico); }
.worked-row.cat-mentale .worked-cat { color: var(--c-mentale); }
.worked-row.cat-fisico .worked-cat { color: var(--c-fisico); }
.ob-edit { display: grid; gap: 8px; }
.ob-row { display: flex !important; align-items: center; gap: 10px; }
.ob-row span { flex: 0 0 70px; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.ob-row input { flex: 1; min-width: 0; }
.ob-row.cat-tecnico span { color: var(--c-tecnico); } .ob-row.cat-tattico span { color: var(--c-tattico); } .ob-row.cat-mentale span { color: var(--c-mentale); }

/* ── Editor: colpi allenati e righe di obiettivi con spunta ── */
.ob-group { margin-top: 16px; padding: 10px 12px; border-radius: 12px; background: var(--grey-soft); border-left: 4px solid var(--line); display: grid; gap: 8px; }
.ob-group.cat-tecnico { border-left-color: var(--c-tecnico); } .ob-group.cat-tattico { border-left-color: var(--c-tattico); }
.ob-group.cat-mentale { border-left-color: var(--c-mentale); } .ob-group.cat-fisico { border-left-color: var(--c-fisico); }
.ob-group-head { display: flex; justify-content: space-between; align-items: center; font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.ob-group.cat-tecnico .ob-group-head span:first-child { color: var(--c-tecnico); } .ob-group.cat-tattico .ob-group-head span:first-child { color: var(--c-tattico); }
.ob-group.cat-mentale .ob-group-head span:first-child { color: var(--c-mentale); } .ob-group.cat-fisico .ob-group-head span:first-child { color: var(--c-fisico); }
.ob-done-head { color: var(--muted); font-size: .7rem; }
.ob-line { display: flex; gap: 8px; align-items: center; }
.ob-line input[data-ob="testo"] { flex: 1; min-width: 0; background: #fff; }
.ob-line select { flex: 0 0 112px; background: #fff; }
.ob-done { display: flex !important; align-items: center; justify-content: center; flex: 0 0 44px; height: 42px; margin: 0; cursor: pointer; }
.ob-done input { position: absolute; opacity: 0; pointer-events: none; }
.ob-done span { width: 34px; height: 34px; border-radius: 50%; border: 2px solid #c9d3d9; background: #fff; display: grid; place-items: center; font-weight: 900; color: transparent; transition: .12s; }
.ob-done input:checked + span { background: var(--green); border-color: var(--green); color: #fff; }
.ob-done input:focus-visible + span { outline: 2px solid var(--navy); outline-offset: 2px; }
@media (max-width: 600px) { .ob-line { flex-wrap: wrap; } .ob-line select { flex: 1 1 100%; } .ob-line input[data-ob="testo"] { flex: 1 1 0; } }
.chips.colpi .chip.sel { background: var(--navy); color: #fff; border-color: var(--navy); }
.chip.ok { background: var(--green-soft); color: var(--green); border-color: var(--green); font-weight: 700; }

/* ── Lezione: colpi + obiettivi con esito ── */
.lesson-obj { display: grid; gap: 10px; }
.colpi-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.colpo-tag { font-size: .82rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--navy); color: #fff; }
.ob-item { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 3px 0; }
.ob-item + .ob-item { border-top: 1px dashed #d9e0e4; padding-top: 6px; }
.ob-text { line-height: 1.35; }
.ob-mark { flex: 0 0 auto; font-size: .7rem; font-weight: 800; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.ob-mark.ok { background: var(--green); color: #fff; }
.ob-mark.todo { background: var(--amber-soft, #fdf3e1); color: var(--amber, #b7791f); }

/* ── Obiettivi per colpo ── */
.colpo-group { margin-bottom: 14px; }
.colpo-head { display: flex; justify-content: space-between; align-items: baseline; font-weight: 800; margin: 6px 2px 8px; }
@media (max-width: 600px) { .worked-row { flex-direction: column; gap: 4px; } .worked-cat { flex: none; padding-top: 0; } .worked-body { width: 100%; } }
@media (max-width: 600px) { .ob-line { flex-wrap: nowrap; } .ob-line select { flex: 0 0 96px; font-size: .85rem; padding-left: 6px; padding-right: 4px; } .ob-line input[data-ob="testo"] { flex: 1 1 auto; } }

/* ── Livelli 15 · 30 · 40 · GAME: cerchio che si riempie a spicchi ── */
.pie { width: 20px; height: 20px; flex: 0 0 auto; display: inline-block; vertical-align: middle; }
.pie .pie-bg { fill: #fff; }
.pie .pie-fill { fill: #14212b; }
.pie .pie-ring { fill: none; stroke: #14212b; stroke-width: 2; }
.lv-tag { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: .78rem; padding: 3px 9px 3px 4px; border-radius: 999px; background: #eef2f4; color: #14212b; }
.lv-tag b { font-weight: 900; letter-spacing: .02em; }
.lv-tag span { color: var(--muted); font-weight: 600; }
.lv-tag.lv-4 { background: var(--green-soft); }
.lv-tag.lv-4 b, .lv-tag.lv-4 span { color: var(--green); }
.lv-tag.lv-0 span { color: var(--muted); }
.lv-pick { display: inline-flex; gap: 4px; }
.lv-pick button { display: flex; flex-direction: column; align-items: center; gap: 1px; border: 1.5px solid transparent; background: #fff; border-radius: 10px; padding: 4px 6px; cursor: pointer; opacity: .45; min-width: 44px; }
.lv-pick button span { font-size: .66rem; font-weight: 800; color: #14212b; }
.lv-pick button .pie { width: 22px; height: 22px; }
.lv-pick button.on { opacity: 1; border-color: #14212b; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.lv-pick button:hover { opacity: .85; }
.lv-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .8rem; color: var(--muted); margin: 10px 0 2px; }
.lv-legend span { display: inline-flex; align-items: center; gap: 5px; }
.lv-legend b { color: #14212b; }
.lv-hist { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: .74rem; color: var(--muted); }
.lv-hist span { display: inline-flex; align-items: center; gap: 3px; }
.lv-hist .pie { width: 14px; height: 14px; }
.lv-hist b { color: #14212b; }
.lv-hist i { font-style: normal; color: #b6c2c9; }
.goal-lv-edit { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* editor della lezione */
.ob-line { flex-wrap: wrap; }
.ob-lv { flex: 0 0 auto; }
.ob-line:not(.has-text) .ob-lv { display: none; }
@media (max-width: 600px) { .ob-line { flex-wrap: wrap !important; } .ob-lv { flex: 1 1 100%; display: flex; justify-content: flex-end; } .ob-line:not(.has-text) .ob-lv { display: none; } }
.lv-rows { display: grid; gap: 6px; }
.lv-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 8px; border-radius: 10px; background: var(--grey-soft); border-left: 3px solid var(--line); }
.lv-row.cat-tecnico { border-left-color: var(--c-tecnico); } .lv-row.cat-tattico { border-left-color: var(--c-tattico); }
.lv-row.cat-mentale { border-left-color: var(--c-mentale); } .lv-row.cat-fisico { border-left-color: var(--c-fisico); }
.lv-row-t { font-size: .88rem; flex: 1 1 160px; }
.ob-line input[data-ob="testo"] { flex: 1 1 0 !important; min-width: 120px; }
.tag.tessera { background: #14212b; color: #fff; }
.tag.tessera.fitp { background: #1f6fb2; }
.tag.tessera { text-transform: none; letter-spacing: 0; }
.tag.tessera.expired { background: #fbeaea; color: var(--danger); }
.imp-sum { padding: 10px 12px; border-radius: 10px; background: var(--green-soft); }
.imp-list { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.imp-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; font-size: .88rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.imp-row:last-child { border-bottom: 0; }
.imp-row.same { opacity: .5; }
.imp-row.approx { background: #fff8e1; }
.imp-chk { display: flex !important; align-items: center; gap: 8px; margin: 0; font-weight: 600; flex-wrap: wrap; }
.imp-chk input { width: 18px; height: 18px; }

/* ── Le mie tessere ── */
.tess-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.tess-card { padding: 16px 18px; display: grid; gap: 10px; color: #fff; border: 0; background: linear-gradient(135deg, #14212b, #24404f); }
.tess-card.fitp { background: linear-gradient(135deg, #154f86, #1f6fb2); }
.tess-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tess-top b { font-size: 1.15rem; letter-spacing: .06em; }
.tess-top span { font-size: .72rem; opacity: .8; text-align: right; }
.tess-num { font-size: 1.7rem; font-weight: 800; letter-spacing: .08em; font-variant-numeric: tabular-nums; user-select: all; -webkit-user-select: all; }
.tess-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .82rem; opacity: .95; }
.tess-foot .btn { background: rgba(255,255,255,.15); color: #fff; border-color: rgba(255,255,255,.35); }
.tess-exp { background: #fbeaea; color: var(--danger); padding: 2px 8px; border-radius: 6px; font-weight: 700; }
