:root {
  --bg: #0a0f1d; --bg2: #0f1628; --card: #141d33; --card2: #1b2642; --line: #263354;
  --ink: #eef2fb; --ink2: #aab4d0; --ink3: #6f7b9c;
  --acc: #ff7a3d; --acc-ink: #1d0b02; --acc-soft: rgba(255,122,61,.14);
  --green: #3ddc97; --orange: #ffb547; --red: #ff5d6c; --blue: #6aa8ff; --violet: #a98bff;
  --radius: 20px; --tab-h: 64px;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 10px 26px -12px rgba(0,0,0,.65);
  --shadow-lg: 0 1px 0 rgba(255,255,255,.05) inset, 0 22px 44px -16px rgba(0,0,0,.8);
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 Inter, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { min-height: 100dvh; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--acc); }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.02em; }
h1 { font-size: 27px; font-weight: 900; letter-spacing: -0.03em; }
h2 { font-size: 18px; font-weight: 800; }
h3 { font-size: 15px; font-weight: 750; }
p { margin: 0; }
.muted { color: var(--ink2); } .dim { color: var(--ink3); } .small { font-size: 13px; } .tiny { font-size: 11.5px; }
.num { font-variant-numeric: tabular-nums; } .b { font-weight: 750; }

/* layout */
#app { max-width: 600px; margin: 0 auto; padding: calc(var(--safe-t) + 12px) 16px calc(var(--tab-h) + var(--safe-b) + 40px); }
.top { display: flex; align-items: center; gap: 10px; margin: 4px 0 16px; min-height: 42px; }
.top .grow { flex: 1; min-width: 0; }
.back, .round-btn { width: 42px; height: 42px; border-radius: 50%; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; flex: none; color: var(--ink); text-decoration: none; position: relative; }
.round-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--bg); }
.stack { display: flex; flex-direction: column; gap: 12px; } .stack.tight { gap: 6px; }
.row { display: flex; align-items: center; gap: 10px; } .row.wrap { flex-wrap: wrap; } .row.between { justify-content: space-between; } .row.top-a { align-items: flex-start; }
.grow { flex: 1; min-width: 0; } .ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 2px 12px; gap: 10px; }
.section-title a, .link { color: var(--acc); font-size: 13.5px; font-weight: 700; text-decoration: none; cursor: pointer; background: none; border: 0; padding: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

/* card */
.card { background: linear-gradient(180deg, rgba(255,255,255,.025), transparent 60%), var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px; box-shadow: var(--shadow); }
.card.tap, .tap { cursor: pointer; transition: transform .1s; } .card.tap:active { transform: scale(.985); }
a.card { display: block; color: inherit; text-decoration: none; }
.card.flat { background: var(--bg2); box-shadow: none; }
.card.warn { border-color: rgba(255,181,71,.45); background: linear-gradient(135deg, rgba(255,181,71,.10), transparent 70%), var(--card); }
.card.bad { border-color: rgba(255,93,108,.45); background: linear-gradient(135deg, rgba(255,93,108,.10), transparent 70%), var(--card); }
.list { display: flex; flex-direction: column; } .list > * + * { border-top: 1px solid var(--line); }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 2px; color: inherit; text-decoration: none; }
a.item, button.item { cursor: pointer; background: none; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; text-align: left; }
.list > button.item:first-child { border-top: 0; }
.empty { text-align: center; color: var(--ink3); padding: 26px 10px; font-size: 14px; }

/* banner: pista di atletica stilizzata */
.hero {
  --ink: #fff; --ink2: rgba(255,255,255,.76); --ink3: rgba(255,255,255,.55); --line: rgba(255,255,255,.16); --card: rgba(255,255,255,.08); --bg2: rgba(0,0,0,.2);
  color: var(--ink); border: 0 !important; position: relative; overflow: hidden; isolation: isolate; box-shadow: var(--shadow-lg);
  background: radial-gradient(90% 120% at 100% 0%, rgba(255,122,61,.32), transparent 55%), radial-gradient(70% 90% at 0% 100%, rgba(61,220,151,.18), transparent 60%), linear-gradient(160deg, #1d2c55, #0e1630 75%) !important;
}
.hero::before { content: ''; position: absolute; z-index: -1; right: -90px; top: -40px; width: 300px; height: 220px; border-radius: 120px;
  background: repeating-radial-gradient(ellipse at center, transparent 0 16px, rgba(255,255,255,.10) 16px 18px); opacity: .9; pointer-events: none;
  mask: linear-gradient(90deg, transparent, #000 35%); -webkit-mask: linear-gradient(90deg, transparent, #000 35%); }
.hero .btn:not(.primary) { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.2); color: #fff; }
.crest { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; font-weight: 900; font-size: 17px; color: #fff; background: linear-gradient(150deg, var(--acc), #e2522a); box-shadow: 0 8px 20px -8px rgba(255,122,61,.7); flex: none; letter-spacing: -.02em; }
.crest.lg { width: 74px; height: 74px; border-radius: 22px; font-size: 26px; }

/* bottoni */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--line); background: var(--card2); font-weight: 750; cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap; transition: transform .08s; }
.btn:active { transform: scale(.97); } .btn[disabled] { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); box-shadow: 0 8px 22px -8px rgba(255,122,61,.6); }
.btn.green { background: var(--green); color: #032013; border-color: var(--green); }
.btn.ghost { background: transparent; } .btn.danger { background: transparent; color: var(--red); border-color: rgba(255,93,108,.5); }
.btn.block { width: 100%; } .btn.sm { min-height: 38px; padding: 0 15px; font-size: 13.5px; } .btn.xs { min-height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn.icon { width: 44px; padding: 0; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.quick a { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 4px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; font-weight: 750; font-size: 12px; text-align: center; line-height: 1.2; color: var(--ink); text-decoration: none; }
.quick a:active { transform: scale(.96); }
.quick .ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--acc); color: var(--acc-ink); }
.quick a:nth-child(2) .ico { background: var(--green); color: #032013; } .quick a:nth-child(3) .ico { background: var(--blue); color: #061430; } .quick a:nth-child(4) .ico { background: var(--violet); color: #12082b; }

/* chip, badge, segmenti */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 4px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 13px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip input { accent-color: var(--acc); margin: 0; } .chip:has(input:checked) { border-color: var(--acc); color: var(--acc); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 750; background: var(--card2); color: var(--ink2); white-space: nowrap; }
.badge.ok { background: rgba(61,220,151,.14); color: var(--green); } .badge.warn { background: rgba(255,181,71,.16); color: var(--orange); }
.badge.bad { background: rgba(255,93,108,.16); color: var(--red); } .badge.acc { background: var(--acc-soft); color: var(--acc); } .badge.blue { background: rgba(106,168,255,.15); color: var(--blue); }
.seg { display: flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; padding: 4px; gap: 4px; }
.seg button, .seg a { flex: 1; border: 0; background: transparent; border-radius: 999px; padding: 9px 6px; font-weight: 700; font-size: 13.5px; color: var(--ink2); cursor: pointer; text-align: center; text-decoration: none; position: relative; }
.seg .on { background: var(--card2); color: var(--ink); box-shadow: 0 4px 12px -4px rgba(0,0,0,.5); }
.seg .n { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--red); color: #fff; font-size: 10.5px; margin-left: 4px; }
.gdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--gc); flex: none; }
.gtag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; border-radius: 99px; font-size: 11.5px; font-weight: 750; color: var(--gc); background: color-mix(in srgb, var(--gc) 15%, transparent); white-space: nowrap; }
.gtag::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--gc); }

/* avatar */
.av { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; color: #0b1020; }
.av.sm { width: 28px; height: 28px; font-size: 11px; } .av.lg { width: 64px; height: 64px; font-size: 22px; } .av.xs { width: 22px; height: 22px; font-size: 9px; }
.avs { display: flex; } .avs .av { border: 2px solid var(--card); } .avs .av + .av { margin-left: -9px; }

/* form */
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink2); font-weight: 650; }
.in, select.in, textarea.in { width: 100%; min-height: 48px; background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; outline: none; font-size: 15.5px; color: var(--ink); }
.in:focus { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
textarea.in { min-height: 90px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--ink2); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--acc); flex: none; margin-top: 1px; }
.switch { position: relative; width: 48px; height: 28px; flex: none; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--green); } .switch input:checked + span::after { transform: translateX(20px); }
fieldset { border: 0; padding: 0; margin: 0; }

/* "da fare" in home */
.todo { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); color: inherit; text-decoration: none; box-shadow: var(--shadow); cursor: pointer; }
.todo .ti { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--acc-soft); color: var(--acc); }
.todo.bad .ti { background: rgba(255,93,108,.15); color: var(--red); } .todo.warn .ti { background: rgba(255,181,71,.15); color: var(--orange); } .todo.ok .ti { background: rgba(61,220,151,.14); color: var(--green); } .todo.blue .ti { background: rgba(106,168,255,.15); color: var(--blue); }
.todo b { display: block; font-size: 14.5px; } .todo span { font-size: 12.5px; color: var(--ink2); }

/* eventi */
a.card.ev, .ev { display: flex; gap: 13px; align-items: stretch; text-decoration: none; color: inherit; }
.ev-when { width: 58px; flex: none; border-radius: 15px; background: var(--card2); border: 1px solid var(--line); text-align: center; padding: 8px 0; display: flex; flex-direction: column; justify-content: center; }
.ev-when b { display: block; font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ev-when span { display: block; font-size: 10.5px; font-weight: 750; color: var(--acc); text-transform: uppercase; letter-spacing: .04em; }
.ev.k-partita .ev-when, .ev.k-gara .ev-when { background: linear-gradient(160deg, rgba(255,122,61,.25), rgba(255,122,61,.08)); border-color: rgba(255,122,61,.4); }
.ev.cancelled { opacity: .55; } .ev.cancelled h3 { text-decoration: line-through; }
.day-h { font-size: 12.5px; font-weight: 800; color: var(--ink3); text-transform: uppercase; letter-spacing: .06em; margin: 20px 2px 8px; }
.day-h.today { color: var(--acc); }
.rsvp { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.rsvp button { border: 1px solid var(--line); background: var(--bg2); border-radius: 12px; padding: 9px 4px; font-weight: 750; font-size: 13px; cursor: pointer; color: var(--ink2); }
.rsvp button.on.si { background: var(--green); border-color: var(--green); color: #032013; }
.rsvp button.on.no { background: var(--red); border-color: var(--red); color: #fff; }
.rsvp button.on.forse { background: var(--orange); border-color: var(--orange); color: #241202; }
.rsvp.locked button { pointer-events: none; opacity: .6; }
.meter { height: 8px; border-radius: 99px; background: var(--bg2); overflow: hidden; display: flex; }
.meter i { display: block; height: 100%; } .meter .g { background: var(--green); } .meter .o { background: var(--orange); } .meter .r { background: var(--red); }
.score { font-size: 40px; font-weight: 900; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.att { display: flex; align-items: center; gap: 10px; padding: 10px 2px; cursor: pointer; }
.att .tick { width: 30px; height: 30px; border-radius: 10px; border: 2px solid var(--line); display: grid; place-items: center; color: transparent; flex: none; }
.att.on .tick { background: var(--green); border-color: var(--green); color: #032013; }

/* bacheca */
.post .pin { color: var(--acc); }
.post .body { white-space: normal; color: var(--ink); font-size: 14.5px; margin-top: 6px; }
.poll button { width: 100%; text-align: left; border: 1px solid var(--line); background: var(--bg2); border-radius: 12px; padding: 10px 12px; margin-top: 6px; cursor: pointer; position: relative; overflow: hidden; font-weight: 650; }
.poll button i { position: absolute; inset: 0 auto 0 0; background: var(--acc-soft); z-index: 0; } .poll button span { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 8px; }
.poll button.mine { border-color: var(--acc); }

/* chat */
.chat { display: flex; flex-direction: column; gap: 6px; padding-bottom: 80px; }
.bubble { max-width: 82%; padding: 8px 12px 6px; border-radius: 18px; background: var(--card2); align-self: flex-start; font-size: 14.5px; line-height: 1.38; word-wrap: break-word; }
.bubble.me { align-self: flex-end; background: var(--acc); color: var(--acc-ink); border-bottom-right-radius: 6px; } .bubble:not(.me) { border-bottom-left-radius: 6px; }
.bubble .who { font-size: 11.5px; font-weight: 800; color: var(--acc); margin-bottom: 1px; } .bubble .when { font-size: 10.5px; opacity: .6; text-align: right; margin-top: 2px; }
.bubble.me a { color: inherit; }
.composer { position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + var(--safe-b) + 16px); z-index: 15; max-width: 600px; margin: 0 auto; padding: 0 16px; display: flex; gap: 8px; }
.composer .in { border-radius: 999px; background: var(--card); box-shadow: var(--shadow-lg); }
.composer .btn { box-shadow: var(--shadow-lg); }
.locked-note { text-align: center; font-size: 12.5px; color: var(--ink3); padding: 10px; border: 1px dashed var(--line); border-radius: 14px; }

/* KPI e tabelle */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 13px 15px; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: block; }
.kpi .v { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 2px; letter-spacing: -0.02em; }
.kpi .l { font-size: 12px; color: var(--ink2); font-weight: 650; } .kpi.bad .v { color: var(--red); } .kpi.warn .v { color: var(--orange); } .kpi.ok .v { color: var(--green); }
.bar { height: 10px; border-radius: 99px; background: var(--bg2); overflow: hidden; } .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), #8ef0c4); border-radius: 99px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.table th { text-align: left; color: var(--ink3); font-weight: 700; font-size: 12px; padding: 6px 4px; }
.table td { padding: 9px 4px; border-top: 1px solid var(--line); } .table .r { text-align: right; }
.pb { color: var(--acc); font-weight: 800; font-size: 11px; }

/* firma e ricevuta */
.docbox { background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: 14px; color: var(--ink2); max-height: 200px; overflow: auto; }
.sig { font-family: "Segoe Script", "Brush Script MT", cursive; font-size: 22px; color: var(--ink); }
.receipt { background: #fff; color: #1b1f2c; border-radius: 18px; padding: 22px; font-size: 14px; }
.receipt h2 { color: #1b1f2c; } .receipt .muted { color: #555d70; } .receipt .line { border-top: 1px dashed #c9cede; margin: 12px 0; }
.receipt .tot { font-size: 26px; font-weight: 900; }
.pay-fake { background: #fff; color: #1a1f36; border-radius: 18px; padding: 18px; }
.pay-fake .in { background: #f6f8fa; border-color: #e3e8ee; color: #1a1f36; }
.pay-fake .btn.primary { background: #635bff; border-color: #635bff; color: #fff; box-shadow: none; }
.pm { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1.5px solid var(--line); border-radius: 14px; cursor: pointer; }
.pm:has(input:checked) { border-color: var(--acc); background: var(--acc-soft); } .pm input { accent-color: var(--acc); }
.pm-logo { width: 46px; height: 28px; border-radius: 7px; display: grid; place-items: center; font-size: 10.5px; font-weight: 900; color: #fff; flex: none; }
.pm-carta { background: #1a1f36; } .pm-satispay { background: #f94c43; font-size: 15px; } .pm-bonifico { background: #2f6f5e; }

/* tab bar */
.tabs { position: fixed; left: 12px; right: 12px; bottom: calc(10px + var(--safe-b)); z-index: 20; max-width: 576px; margin: 0 auto; background: rgba(20,29,51,.88); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow-lg); }
.tabs nav { display: grid; grid-template-columns: repeat(5, 1fr); height: var(--tab-h); padding: 0 6px; }
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--ink3); text-decoration: none; font-size: 10.5px; font-weight: 700; position: relative; }
.tabs a svg { width: 22px; height: 22px; padding: 4px 14px; box-sizing: content-box; border-radius: 999px; transition: background .2s; }
.tabs a.on { color: var(--ink); } .tabs a.on svg { background: var(--acc); color: var(--acc-ink); }
.tabs a .n { position: absolute; top: 4px; left: calc(50% + 8px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--red); color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; }

/* sheet, toast, varie */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(2px); z-index: 40; animation: fade .18s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 92dvh; overflow-y: auto; background: var(--bg2); border-top: 1px solid var(--line); border-radius: 28px 28px 0 0; padding: 10px 16px calc(20px + var(--safe-b)); animation: up .24s cubic-bezier(.2,.8,.2,1); max-width: 600px; margin: 0 auto; box-shadow: 0 -10px 40px rgba(0,0,0,.5); }
.sheet .card { box-shadow: none; }
.sheet .grab { width: 42px; height: 5px; background: var(--line); border-radius: 9px; margin: 0 auto 14px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } } @keyframes fade { from { opacity: 0; } }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + var(--safe-b) + 24px); z-index: 60; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 16px; font-weight: 700; font-size: 14px; max-width: calc(100% - 32px); box-shadow: var(--shadow-lg); animation: up .2s; }
.toast.err { background: var(--red); color: #fff; }
.demo-bar { background: var(--acc-soft); border: 1px dashed rgba(255,122,61,.45); color: var(--acc); border-radius: 999px; padding: 7px 8px 7px 14px; font-size: 12.5px; font-weight: 700; margin-bottom: 14px; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.demo-bar span { display: inline-flex; align-items: center; gap: 6px; }
.demo-bar .link { color: var(--acc-ink); background: var(--acc); padding: 4px 12px; border-radius: 999px; font-size: 12px; }
.spinner { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--acc); border-radius: 50%; animation: spin .7s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 900px) { body.wide #app { max-width: 1000px; } body.wide .kpis { grid-template-columns: repeat(4, 1fr); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print {
  body { background: #fff; } .tabs, .demo-bar, .top, .no-print { display: none !important; }
  #app { padding: 0; max-width: none; } .receipt { border-radius: 0; padding: 0; }
}
