/* =========================================================================
   VirtusAdda · Design System
   Base "Stadio Tipografico" (Bebas + diagonale scudo) + momenti Cigno&Acqua.
   Token light/dark (auto via prefers-color-scheme + override [data-theme]).
   Mobile-first, profilo Redmi Note 13 Pro.
   ========================================================================= */

:root {
  --font-display: 'Bebas Neue', system-ui, sans-serif;
  --font-body: 'Hanken Grotesk', system-ui, sans-serif;

  /* Brand */
  --red: #DB2C39;
  --red-dk: #B11F2A;
  --blue: #28489F;
  --blue-dk: #1C3373;
  --navy: #0E1B44;

  /* Superfici (light) */
  --paper: #F6F8FC;
  --card: #FFFFFF;
  --soft: #EEF1F8;
  --ink: #101A33;
  --muted: #8A93AC;
  --line: #EAEEF6;

  /* Stati */
  --ok: #1FA463;
  --ok-bg: #E4F6ED;
  --amber: #E89A2C;
  --amber-bg: #FCF1DF;

  --shell-max: 480px;
  --tabbar-h: 70px;
  --radius: 18px;
}

/* Dark automatico (se l'utente non ha forzato light) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0B1330;
    --card: #15203F;
    --soft: #1E2A50;
    --ink: #EAF0FF;
    --muted: #9AA6CC;
    --line: #2A3766;
    --red: #FF4D5B;
    --red-dk: #E0303E;
    --blue: #5E7CE6;
    --blue-dk: #3B59C2;
    --ok-bg: #13301F;
    --amber-bg: #34280F;
  }
}

/* Dark forzato */
:root[data-theme="dark"] {
  --paper: #0B1330;
  --card: #15203F;
  --soft: #1E2A50;
  --ink: #EAF0FF;
  --muted: #9AA6CC;
  --line: #2A3766;
  --red: #FF4D5B;
  --red-dk: #E0303E;
  --blue: #5E7CE6;
  --blue-dk: #3B59C2;
  --ok-bg: #13301F;
  --amber-bg: #34280F;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

/* Riserva SEMPRE lo spazio della scrollbar verticale: senza, la shell centrata
   (.app-shell margin:0 auto) saltava a destra/sinistra passando tra pagine corte
   (senza scrollbar) e lunghe (con scrollbar) su desktop Windows. */
html { scrollbar-gutter: stable; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--navy);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

/* ----- Shell mobile centrata ----- */
.app-shell {
  max-width: var(--shell-max);
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--paper);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 60px rgba(0, 0, 0, .35);
}

.va-main {
  flex: 1;
  padding: 4px 18px calc(var(--tabbar-h) + 24px);
}

/* ----- App bar ----- */
.appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 18px;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.appbar .nm { font-family: var(--font-display); letter-spacing: 1px; font-size: 21px; line-height: .82; }
.appbar .nm small { display: block; font-family: var(--font-body); font-size: 9px; letter-spacing: 2.5px; color: var(--muted); font-weight: 800; }
.appbar .bell {
  margin-left: auto; width: 38px; height: 38px; border-radius: 13px;
  background: var(--card); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; font-size: 17px; position: relative; cursor: pointer; color: var(--ink); text-decoration: none;
}

/* ----- Tipografia ----- */
.hello { font-size: 14px; color: var(--muted); font-weight: 700; margin: 10px 0 -2px; }
.display { font-family: var(--font-display); letter-spacing: 1px; line-height: .9; }
.h-xl { font-family: var(--font-display); font-size: 40px; letter-spacing: 1px; line-height: .9; }

/* ----- Divisore di sezione (diagonale scudo) ----- */
.divh { display: flex; align-items: center; gap: 12px; margin: 26px 0 14px; }
.divh b { font-family: var(--font-display); font-size: 23px; letter-spacing: 1.5px; }
.divh .ln { flex: 1; height: 3px; border-radius: 3px;
  background: linear-gradient(100deg, var(--red) 0 48%, var(--blue) 52% 100%);
  clip-path: polygon(0 0, 100% 0, calc(100% - 6px) 100%, 0 100%); }
.divh a { font-size: 12px; color: var(--blue); font-weight: 800; }

/* ----- Hero "Prenota" ----- */
.hero {
  position: relative; margin-top: 14px; border-radius: 26px; overflow: hidden; color: #fff; padding: 24px;
  background: linear-gradient(116deg, var(--red) 0%, var(--red) 46%, var(--blue) 54%, var(--blue) 100%);
  box-shadow: 0 22px 40px -16px color-mix(in srgb, var(--blue) 70%, transparent);
  min-height: 168px; display: flex; flex-direction: column; justify-content: space-between;
}
.hero .swan { position: absolute; right: -10px; bottom: -14px; width: 150px; opacity: .16; }
.hero .tag { position: relative; font-size: 11px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; opacity: .92; }
.hero h3 { position: relative; font-family: var(--font-display); font-size: 44px; letter-spacing: 1px; line-height: .84; margin-top: 4px; }
.hero .go { position: relative; align-self: flex-start; display: inline-flex; align-items: center; gap: 9px;
  background: #fff; color: var(--ink); font-weight: 800; font-size: 13.5px; padding: 12px 18px; border-radius: 100px; margin-top: 14px; }
.hero .go .arw { font-family: var(--font-display); font-size: 20px; color: var(--red); }

/* ----- Scorciatoie ----- */
.qrow { display: flex; gap: 11px; }
.qcard { flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; position: relative; overflow: hidden; }
.qcard::before { content: ""; position: absolute; top: 0; left: 0; width: 5px; height: 100%; background: var(--blue); }
.qcard.red::before { background: var(--red); }
.qcard .ic { font-size: 22px; margin-bottom: 8px; display: block; }
.qcard h4 { font-size: 13.5px; font-weight: 800; }
.qcard span { font-size: 11px; color: var(--muted); font-weight: 700; }

/* ----- Card sede ----- */
.sede-card { display: flex; align-items: center; gap: 13px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; }
.sede-card .badge { width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center; color: #fff; font-family: var(--font-display); font-size: 22px;
  background: linear-gradient(120deg, var(--navy), var(--blue)); flex: 0 0 auto; }
.sede-card .info { flex: 1; }
.sede-card .info h4 { font-size: 14.5px; font-weight: 800; display: flex; align-items: center; gap: 7px; }
.sede-card .info p { font-size: 11.5px; color: var(--muted); font-weight: 700; margin-top: 3px; }
.sede-card .chev { color: var(--muted); font-size: 20px; }
.pill-mini { font-size: 9px; font-weight: 800; letter-spacing: .5px; padding: 3px 8px; border-radius: 100px; background: var(--soft); color: var(--blue); text-transform: uppercase; }

/* ----- Prossima prenotazione ----- */
.book { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.book .day { text-align: center; padding-right: 14px; border-right: 2px solid var(--line); }
.book .day b { font-family: var(--font-display); font-size: 38px; display: block; line-height: .8; color: var(--blue); }
.book .day span { font-size: 10px; font-weight: 800; letter-spacing: 1.5px; color: var(--muted); text-transform: uppercase; }
.book .info { flex: 1; }
.book .info h4 { font-size: 14px; font-weight: 800; }
.book .info p { font-size: 11.5px; color: var(--muted); font-weight: 700; margin-top: 4px; }

/* ----- Empty state ----- */
.empty { text-align: center; padding: 28px 18px; background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.empty .ic { font-size: 30px; display: block; margin-bottom: 8px; }
.empty b { color: var(--ink); display: block; font-size: 14px; }
.empty span { font-size: 12px; }

/* ----- Bottoni ----- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; width: 100%;
  border: none; border-radius: var(--radius); font-family: var(--font-body); font-weight: 800; font-size: 15px; padding: 16px; cursor: pointer; color: #fff;
  background: linear-gradient(100deg, var(--red), var(--red-dk)); box-shadow: 0 14px 26px -12px color-mix(in srgb, var(--red) 60%, transparent); }
.btn.blue { background: linear-gradient(100deg, var(--blue), var(--blue-dk)); box-shadow: 0 14px 26px -12px color-mix(in srgb, var(--blue) 60%, transparent); }
.btn.ghost { background: var(--card); color: var(--ink); border: 1.5px solid var(--line); box-shadow: none; }
.btn .arw { font-family: var(--font-display); font-size: 22px; }

/* ----- Tab bar ----- */
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: var(--shell-max);
  height: var(--tabbar-h); background: var(--card); border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-around; padding: 0 10px 8px; z-index: 40; }
.tab { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 9.5px; font-weight: 800; color: var(--muted); }
.tab .ic { font-size: 19px; }
.tab.on { color: var(--blue); }
.tab.fab { margin-top: -26px; }
.tab.fab .ic { width: 54px; height: 54px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 26px;
  background: linear-gradient(116deg, var(--red) 0 47%, var(--blue) 53% 100%); box-shadow: 0 12px 24px -8px color-mix(in srgb, var(--blue) 70%, transparent); }

/* ----- Prenota: selettori ----- */
.row-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.row-scroll::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px; background: var(--card); border: 1.5px solid var(--line); border-radius: 100px; padding: 9px 14px; font-size: 12px; font-weight: 800; color: var(--muted); white-space: nowrap; cursor: pointer; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.chip.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip.on .dot { background: #fff; }
.lbl { font-size: 10px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); font-weight: 800; margin: 16px 0 8px; }
.dates { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.dates::-webkit-scrollbar { display: none; }
.date { flex: 0 0 auto; width: 52px; text-align: center; background: var(--card); border: 1.5px solid var(--line); border-radius: 15px; padding: 9px 0; cursor: pointer; }
.date span { font-size: 9.5px; font-weight: 800; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }
.date b { font-family: var(--font-display); font-size: 24px; display: block; line-height: .9; margin-top: 2px; color: var(--ink); }
.date.on { background: linear-gradient(116deg, var(--red) 0 47%, var(--blue) 53% 100%); border: none; }
.date.on span, .date.on b { color: #fff; }

/* ----- Prenota: campo vivo ----- */
.pitch-card { margin-top: 14px; border-radius: 22px; overflow: hidden; position: relative; background: var(--card); border: 1px solid var(--line); }
.pitch { position: relative; height: 160px; background: repeating-linear-gradient(90deg, var(--grass) 0 28px, var(--grass-dk) 28px 56px); }
.pitch svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.pitch .meteo { position: absolute; top: 10px; left: 10px; display: flex; align-items: center; gap: 7px; background: rgba(255,255,255,.92); border-radius: 100px; padding: 6px 11px; font-size: 11.5px; font-weight: 800; color: #101A33; }
.pitch .tipo { position: absolute; top: 10px; right: 10px; background: rgba(16,26,51,.78); color: #fff; border-radius: 100px; padding: 6px 11px; font-size: 10px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; }
.pitch .live { position: absolute; bottom: 10px; left: 10px; display: flex; align-items: center; gap: 6px; background: rgba(255,255,255,.92); border-radius: 100px; padding: 5px 10px; font-size: 10.5px; font-weight: 800; color: var(--ok); }

/* ----- Prenota: timeline slot ----- */
.tl-h { display: flex; align-items: center; gap: 12px; margin: 18px 0 10px; }
.tl-h b { font-family: var(--font-display); font-size: 22px; letter-spacing: 1.5px; }
.tl-h .ln { flex: 1; height: 3px; border-radius: 3px; background: linear-gradient(100deg, var(--red) 0 48%, var(--blue) 52% 100%); clip-path: polygon(0 0, 100% 0, calc(100% - 6px) 100%, 0 100%); }
.slot { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-radius: 15px; background: var(--card); border: 1.5px solid var(--line); margin-bottom: 9px; width: 100%; text-align: left; font-family: inherit; cursor: pointer; }
.slot .hr { font-family: var(--font-display); font-size: 28px; line-height: .8; width: 64px; color: var(--ink); }
.slot .hr small { display: block; font-family: var(--font-body); font-size: 9.5px; font-weight: 800; color: var(--muted); }
.slot .st { font-size: 10px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: var(--ok); }
.slot .price { margin-left: auto; font-family: var(--font-display); font-size: 24px; color: var(--blue); }
.slot.libero:hover { border-color: var(--blue); }
.slot.busy { background: var(--soft); border-color: var(--line); opacity: .7; cursor: not-allowed; }
.slot.busy .hr { color: var(--muted); }
.slot.busy .st { color: var(--muted); }
.slot.busy .price { color: var(--muted); }
.slot .serale-tag { font-size: 8.5px; font-weight: 800; color: var(--amber); margin-left: 6px; }

/* ----- Auth (login / registrazione) ----- */
.auth { position: relative; min-height: 100dvh; display: flex; flex-direction: column; }
.auth-band { position: relative; padding: 56px 26px 40px; text-align: center; color: #fff; overflow: hidden;
  background: linear-gradient(118deg, var(--red) 0%, var(--red) 47%, var(--blue) 53%, var(--blue) 100%);
  clip-path: polygon(0 0, 100% 0, 100% 78%, 0 100%); }
.auth-band .crest { filter: drop-shadow(0 12px 26px rgba(0,0,0,.4)); }
.auth-band h1 { font-family: var(--font-display); font-size: 44px; letter-spacing: 1.5px; line-height: .86; margin-top: 12px; }
.auth-band h1 small { display: block; font-size: .3em; letter-spacing: 5px; opacity: .85; font-weight: 800; font-family: var(--font-body); }
.auth-band p { font-size: 12.5px; font-weight: 600; opacity: .92; margin-top: 8px; }
.auth-sheet { flex: 1; margin-top: -18px; background: var(--card); border-radius: 26px 26px 0 0; padding: 26px 24px 36px; position: relative; z-index: 2; }
.auth-sheet h2 { font-family: var(--font-display); font-size: 26px; letter-spacing: 1px; margin-bottom: 4px; }
.auth-sheet .sub { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-bottom: 18px; }
.field { margin-bottom: 13px; text-align: left; }
.field label { display: block; font-size: 10px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); font-weight: 800; margin-bottom: 6px; }
.field input { width: 100%; background: var(--paper); border: 1.5px solid var(--line); border-radius: 14px; padding: 14px 16px; font-size: 14px; font-weight: 600; color: var(--ink); font-family: inherit; }
.field input:focus { outline: none; border-color: var(--blue); }
.auth-err { background: var(--amber-bg); color: var(--red); border-radius: 12px; padding: 11px 14px; font-size: 12.5px; font-weight: 700; margin-bottom: 14px; }
.auth-lk { text-align: center; margin-top: 16px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.auth-lk a { color: var(--blue); font-weight: 800; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 1px; margin: 16px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.social { display: flex; gap: 10px; }
.social .s { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 13px; font-size: 13px; font-weight: 800; color: var(--ink); cursor: pointer; }
.social .s.disabled { opacity: .55; }

/* =========================================================================
   ADATTIVO — l'app utente da mobile (bottom tab) a desktop (top nav)
   ========================================================================= */
.appbar .nav-desktop { display: none; }

.cards-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }

@media (min-width: 768px) {
  :root { --shell-max: 760px; }
  .app-shell { box-shadow: 0 0 60px rgba(0,0,0,.18); border-radius: 0; }
  .va-main { padding: 8px 28px 40px; }
  .tabbar { display: none; }
  .appbar { padding: 14px 28px; }
  .appbar .nav-desktop { display: flex; align-items: center; gap: 4px; margin-left: 22px; }
  .appbar .nav-desktop a { padding: 8px 14px; border-radius: 100px; font-size: 13px; font-weight: 800; color: var(--muted); }
  .appbar .nav-desktop a.on, .appbar .nav-desktop a:hover { background: var(--soft); color: var(--blue); }
  .cards-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .hero { min-height: 200px; }
}

@media (min-width: 1200px) {
  :root { --shell-max: 1080px; }
  .cards-grid { grid-template-columns: 1fr 1fr 1fr; }
}

/* =========================================================================
   BACKEND ADMIN — shell desktop con sidebar
   ========================================================================= */
.admin-shell { min-height: 100dvh; background: var(--paper); color: var(--ink); display: grid; grid-template-columns: 1fr; }
.admin-side { background: var(--navy); color: #fff; padding: 18px 14px; }
.admin-side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.admin-side .brand .t { font-family: var(--font-display); font-size: 20px; letter-spacing: 1px; line-height: .85; }
.admin-side .brand .t small { display: block; font-family: var(--font-body); font-size: 8.5px; letter-spacing: 2.5px; color: #8ea0d8; font-weight: 800; }
.admin-nav { display: flex; gap: 6px; overflow-x: auto; }
.admin-nav a { flex: 0 0 auto; display: flex; align-items: center; gap: 9px; padding: 11px 14px; border-radius: 12px; color: #c4cfee; font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.admin-nav a .ic { font-size: 17px; }
.admin-nav a.on { background: linear-gradient(116deg, var(--red) 0 47%, var(--blue) 53% 100%); color: #fff; }
.admin-nav a:hover:not(.on) { background: rgba(255,255,255,.08); color: #fff; }
.admin-main { padding: 18px; overflow-x: hidden; }
.admin-top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.admin-top h1 { font-family: var(--font-display); font-size: 30px; letter-spacing: 1px; }
.admin-top .sp { flex: 1; }
.admin-top .who { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.admin-top .who b { color: var(--ink); }
.admin-logout { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px; font-weight: 800; font-size: 12.5px; color: var(--ink); cursor: pointer; }

@media (min-width: 900px) {
  .admin-shell { grid-template-columns: 248px 1fr; }
  .admin-side { position: sticky; top: 0; height: 100dvh; }
  .admin-nav { flex-direction: column; overflow: visible; }
  .admin-main { padding: 26px 32px; }
}

/* KPI dashboard */
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 760px) { .kpi-grid { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; top: 0; left: 0; width: 5px; height: 100%; background: linear-gradient(var(--red), var(--blue)); }
.kpi .v { font-family: var(--font-display); font-size: 40px; line-height: .85; color: var(--ink); }
.kpi .k { font-size: 11px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); margin-top: 6px; }

/* Tabella admin */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 6px 4px; margin-top: 18px; overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); font-weight: 800; padding: 12px 14px; border-bottom: 2px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 600; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: none; }
.badge-stato { font-size: 9.5px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; padding: 4px 9px; border-radius: 100px; }
.badge-stato.confermata { background: var(--ok-bg); color: var(--ok); }
.badge-stato.annullata { background: var(--soft); color: var(--muted); }
.badge-stato.checkedin { background: #E9EDFA; color: var(--blue); }
.badge-stato.noshow { background: var(--amber-bg); color: var(--amber); }
.section-title { font-family: var(--font-display); font-size: 22px; letter-spacing: 1px; margin: 24px 0 6px; }

/* ----- Admin: form CRUD ----- */
.adm-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-top: 14px; }
.adm-card h3 { font-family: var(--font-display); font-size: 20px; letter-spacing: 1px; margin-bottom: 12px; }
.adm-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 680px) { .adm-grid { grid-template-columns: repeat(2, 1fr); } .adm-grid .col-full { grid-column: 1 / -1; } }
.adm-field { display: flex; flex-direction: column; gap: 5px; }
.adm-field label { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.adm-input, .adm-select { background: var(--paper); border: 1.5px solid var(--line); border-radius: 11px; padding: 10px 12px; font-size: 13.5px; font-family: inherit; color: var(--ink); font-weight: 600; width: 100%; }
.adm-check { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.adm-actions { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.btn-sm { border: none; border-radius: 11px; padding: 9px 16px; font-weight: 800; font-size: 13px; font-family: inherit; cursor: pointer; color: #fff; background: linear-gradient(100deg, var(--blue), var(--blue-dk)); }
.btn-sm.red { background: linear-gradient(100deg, var(--red), var(--red-dk)); }
.btn-sm.btn-on { box-shadow: inset 0 0 0 2px rgba(255,255,255,.55); filter: brightness(.92); }
.btn-ghost-sm { border: 1.5px solid var(--line); border-radius: 11px; padding: 8px 14px; font-weight: 800; font-size: 12.5px; background: var(--card); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.btn-danger-sm { border: 1.5px solid var(--line); border-radius: 11px; padding: 8px 14px; font-weight: 800; font-size: 12.5px; background: var(--card); color: var(--red); cursor: pointer; }
.adm-alert { border-radius: 12px; padding: 11px 14px; font-size: 13px; font-weight: 700; margin-top: 12px; }
.adm-alert.ok { background: var(--ok-bg); color: var(--ok); }
.adm-alert.err { background: #FDE7E9; color: var(--red-dk); }
:root[data-theme="dark"] .adm-alert.err, .stage[data-theme="dark"] .adm-alert.err { background: #3a1417; color: #ff9aa3; }
.inline-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--blue); font-weight: 800; font-size: 13px; margin-bottom: 8px; }

/* ----- Blocca: selettore grafico campo/area ----- */
.pitch-sel { margin-top: 12px; border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 8px;
  background: repeating-linear-gradient(90deg, var(--grass, #2FA85A) 0 26px, var(--grass-dk, #1F8C46) 26px 52px);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.85); position: relative; }
.pitch-sel .zrow { display: flex; gap: 8px; }
.zone { flex: 1; display: flex; align-items: center; justify-content: center; text-align: center;
  border: 2px solid rgba(255,255,255,.85); border-radius: 10px; padding: 14px 8px; cursor: pointer;
  color: #fff; font-weight: 800; font-size: 12.5px; letter-spacing: .3px; text-shadow: 0 1px 3px rgba(0,0,0,.4);
  background: rgba(255,255,255,.08); transition: .12s; }
.zone:hover { background: rgba(255,255,255,.22); }
.zone.tutto { font-family: var(--font-display); font-size: 17px; letter-spacing: 1.5px; }
.zone.meta { font-size: 11px; padding: 9px 8px; opacity: .92; }
.zone.sel { background: linear-gradient(116deg, var(--red) 0 47%, var(--blue) 53% 100%); border-color: #fff; box-shadow: 0 8px 18px -8px rgba(0,0,0,.5); }
.zone .ck { margin-left: 6px; }

/* Timeline occupazione */
.occ-list { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.occ-item { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 12px; padding: 10px 12px; }
.occ-item .ora { font-family: var(--font-display); font-size: 18px; color: var(--blue); min-width: 96px; }
.occ-item .chi { flex: 1; font-size: 13px; font-weight: 700; }
.occ-item .chi small { display: block; color: var(--muted); font-weight: 700; font-size: 11px; }
.occ-item .area-tag { font-size: 9.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; padding: 3px 8px; border-radius: 100px; background: var(--soft); color: var(--blue); }

/* ----- Agenda: timeline occupazione a fasce ----- */
.tl-sito { font-family: var(--font-display); font-size: 22px; letter-spacing: 1px; margin: 18px 0 4px; display: flex; align-items: center; gap: 8px; }
.tl-campo { font-size: 12.5px; font-weight: 800; color: var(--muted); margin: 8px 0 3px; }
.tl-scale { display: flex; justify-content: space-between; font-size: 9px; font-weight: 800; color: var(--muted); padding: 0 2px; margin-bottom: 2px; }
.tl-track { position: relative; height: 38px; background: var(--soft); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.tl-grid { position: absolute; inset: 0; pointer-events: none; }
.tl-grid span { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.tl-seg { position: absolute; top: 3px; bottom: 3px; border-radius: 7px; padding: 0 7px; overflow: hidden; white-space: nowrap;
  color: #fff; font-size: 10px; font-weight: 800; display: flex; align-items: center; box-shadow: 0 4px 10px -4px rgba(0,0,0,.35);
  background: linear-gradient(116deg, var(--red) 0 47%, var(--blue) 53% 100%); }
.tl-seg.ospite { background: linear-gradient(116deg, var(--amber) 0%, #c97f1e 100%); }

/* =========================================================================
   ANAGRAFICHE — righe read-first con modifica on-demand (<details>, no JS)
   ========================================================================= */
.ana-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.ana-group { font-family: var(--font-display); font-size: 17px; letter-spacing: 1.2px; color: var(--muted); margin: 14px 2px 2px; }
.ana-group:first-child { margin-top: 0; }

details.ana-item { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
details.ana-item > summary { list-style: none; cursor: pointer; }
details.ana-item > summary::-webkit-details-marker { display: none; }
details.ana-item[open] { border-color: var(--blue); box-shadow: 0 10px 24px -14px color-mix(in srgb, var(--blue) 45%, transparent); }

.ana-row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; }
.ana-badge { width: 40px; height: 40px; border-radius: 12px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 18px; color: #fff; background: linear-gradient(120deg, var(--navy), var(--blue)); }
.ana-title { flex: 1; min-width: 0; font-weight: 800; font-size: 14px; }
.ana-title small { display: block; color: var(--muted); font-weight: 700; font-size: 11px; margin-top: 2px; }
.ana-pills { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ana-hint { flex: 0 0 auto; font-size: 11px; font-weight: 800; color: var(--blue); display: inline-flex; align-items: center; gap: 4px; }
.ana-hint::after { content: "▾"; transition: transform .15s; }
details.ana-item[open] .ana-hint::after { transform: rotate(180deg); }
.ana-hint.link::after { content: "›"; font-size: 14px; }
a.ana-item { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
a.ana-item:hover { border-color: var(--blue); }

.ana-edit { padding: 14px 16px 16px; border-top: 1px dashed var(--line); background: color-mix(in srgb, var(--soft) 45%, var(--card)); }
.ana-danger { display: flex; justify-content: flex-end; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }

details.ana-add { border: 1.5px dashed color-mix(in srgb, var(--blue) 45%, var(--line)); border-radius: 16px; background: transparent; }
details.ana-add > summary { list-style: none; cursor: pointer; padding: 13px 16px; font-weight: 800; font-size: 13.5px; color: var(--blue); }
details.ana-add > summary::-webkit-details-marker { display: none; }
details.ana-add[open] { background: var(--card); border-style: solid; border-color: var(--blue); }
details.ana-add .ana-edit { border-top: none; background: transparent; padding-top: 4px; }

/* Griglia checkbox (assegnazione squadre all'utente) */
.chk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 10px; margin-top: 6px; }
.chk-item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; cursor: pointer;
  padding: 6px 9px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.chk-item:has(input:checked) { border-color: var(--blue); background: color-mix(in srgb, var(--blue) 8%, var(--card)); }
.chk-item input { accent-color: var(--blue); margin: 0; }

.pill-ok { font-size: 9px; font-weight: 800; letter-spacing: .5px; padding: 4px 9px; border-radius: 100px; background: var(--ok-bg); color: var(--ok); text-transform: uppercase; white-space: nowrap; }
.pill-warn { font-size: 9px; font-weight: 800; letter-spacing: .5px; padding: 4px 9px; border-radius: 100px; background: var(--amber-bg); color: var(--amber); text-transform: uppercase; white-space: nowrap; }
.pill-mini { white-space: nowrap; }

/* Visualizzatore log applicativi (/admin/log) */
.log-view { max-height: 62vh; overflow: auto; background: var(--ink); border-radius: 12px; padding: 10px 12px;
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 11.5px; line-height: 1.55; }
.log-line { color: #c9d4e3; white-space: pre-wrap; word-break: break-word; }
.log-line.wrn { color: #ffc863; }
.log-line.err { color: #ff8d7e; font-weight: 700; }

/* Calendario campi (/admin/calendario) — vista settimanale stile Teams/Outlook */
.cal-wrap { overflow-x: auto; margin-top: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.cal { min-width: 780px; }
.cal-head, .cal-body { display: grid; grid-template-columns: 54px repeat(7, minmax(98px, 1fr)); }
.cal-head { position: sticky; top: 0; z-index: 2; background: var(--card); border-bottom: 1.5px solid var(--line); border-radius: 14px 14px 0 0; }
.cal-corner { border-right: 1px solid var(--line); }
.cal-dayhead { text-align: center; padding: 8px 4px; border-left: 1px solid var(--line); }
.cal-dayhead span { display: block; font-size: 9.5px; font-weight: 800; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }
.cal-dayhead b { font-family: var(--font-display); font-size: 18px; line-height: 1; }
.cal-dayhead.on { background: color-mix(in srgb, var(--blue) 14%, var(--card)); }
.cal-dayhead.on b { color: var(--blue); }
.cal-gutter { height: 690px; border-right: 1px solid var(--line); }
.cal-hour { height: 46px; text-align: right; padding-right: 6px; }
.cal-hour span { position: relative; top: -6px; font-size: 9.5px; font-weight: 700; color: var(--muted); }
.cal-col { position: relative; height: 690px; border-left: 1px solid var(--line);
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 45px, var(--line) 45px, var(--line) 46px); }
.cal-col.on { background-color: color-mix(in srgb, var(--blue) 5%, var(--card)); }
.cal-ev { position: absolute; overflow: hidden; border-radius: 7px; padding: 2px 5px; color: #fff;
  box-shadow: 0 1px 4px -1px rgba(0,0,0,.45); }
.cal-ev b { display: block; font-size: 9px; font-weight: 800; line-height: 1.1; opacity: .92; }
.cal-ev span { display: block; font-size: 10.5px; font-weight: 800; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev em { display: block; font-size: 9px; font-style: normal; line-height: 1.1; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev.virtus { background: linear-gradient(160deg, var(--blue), var(--blue-dk)); }
.cal-ev.ospite { background: linear-gradient(160deg, #0e9f6e, #057a55); }
.cal-ev.pending { background: repeating-linear-gradient(45deg, var(--amber) 0 9px, color-mix(in srgb, var(--amber) 72%, #000) 9px 18px); color: #2b2000; }
.cal-key { display: inline-block; width: 11px; height: 11px; border-radius: 3px; vertical-align: middle; margin: 0 2px 2px 6px; }
.cal-key.virtus { background: var(--blue); }
.cal-key.ospite { background: #0e9f6e; }
.cal-key.pending { background: var(--amber); }

/* Tabulato settimanale (/admin/tabulato) */
.tab-toolbar { display: flex; align-items: center; gap: 12px; margin: 6px 0 14px; flex-wrap: wrap; }
table.tab-grid { table-layout: fixed; }
table.tab-grid th, table.tab-grid td { vertical-align: top; }
.tab-grid th small { color: var(--muted); font-weight: 700; }
.tab-team { font-weight: 800; font-size: 12.5px; white-space: nowrap; }
.tab-cell { padding: 4px !important; }
.tab-imp { background: color-mix(in srgb, var(--blue) 8%, var(--card)); border-left: 3px solid var(--blue);
  border-radius: 6px; padding: 3px 6px; margin-bottom: 4px; font-size: 11px; line-height: 1.3; }
.tab-imp b { display: block; font-size: 11px; }
.tab-imp.via { background: color-mix(in srgb, var(--amber) 12%, var(--card)); border-left-color: var(--amber); }
.tab-legenda { font-size: 11.5px; color: var(--muted); font-weight: 700; margin: 10px 2px 0; }
.tab-titolo { margin: 0 0 10px; font-size: 15px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg a { padding: 6px 12px; font-size: 12px; font-weight: 800; color: var(--muted); text-decoration: none; }
.seg a.on { background: var(--blue); color: #fff; }

/* Selettore tema (pagina Altro) */
.theme-seg { display: inline-flex; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.theme-seg button { padding: 8px 12px; font-family: var(--font-body); font-size: 12.5px; font-weight: 800;
  color: var(--muted); background: transparent; border: 0; border-left: 1px solid var(--line); cursor: pointer; white-space: nowrap; }
.theme-seg button:first-child { border-left: 0; }
.theme-seg button.on { background: var(--blue); color: #fff; }

/* Toggle tema flottante (pagine a layout minimale: login, mfa, reset…) */
.theme-fab { position: fixed; top: 14px; right: 14px; z-index: 50; width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 18px; cursor: pointer;
  box-shadow: 0 6px 16px -8px rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; }
.theme-fab:hover { border-color: var(--blue); }

@media print {
    .admin-side, .admin-top, .tab-toolbar { display: none !important; }
    .admin-main { padding: 0 !important; }
    .tab-print { box-shadow: none; border: none; }
    .tab-imp { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Splash con logo animato (cold start IIS / caricamento pagina).
   Nascosto di default: NON deve lampeggiare a ogni navigazione. Diventa visibile
   solo al primo caricamento della sessione (html.va-boot, impostato da uno script
   inline nell'head prima del paint) o quando una navigazione è lenta (.is-on,
   aggiunto da splash.js dopo 250ms). */
#app-splash {
  position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 120% at 50% 30%, var(--card) 0%, var(--paper) 70%);
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .35s ease; }
html.va-boot #app-splash, #app-splash.is-on { opacity: 1; visibility: visible; pointer-events: auto; }
.app-splash-box { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.app-splash-badge { position: relative; width: 132px; height: 132px; display: flex; align-items: center; justify-content: center; }
.app-splash-badge img { width: 88px; height: auto; display: block; animation: splash-pulse 1.6s ease-in-out infinite; }
.app-splash-ring { position: absolute; inset: 0; border-radius: 50%;
  border: 4px solid color-mix(in srgb, var(--blue) 16%, transparent);
  border-top-color: var(--red); border-right-color: var(--blue);
  animation: splash-spin 1s linear infinite; }
.app-splash-name { font-family: var(--font-display); font-size: 26px; letter-spacing: 2px; color: var(--navy); }
.app-splash-bar { width: 180px; height: 5px; border-radius: 100px; background: var(--soft); overflow: hidden; }
.app-splash-bar span { display: block; height: 100%; width: 40%; border-radius: 100px;
  background: linear-gradient(90deg, var(--red), var(--blue)); animation: splash-sweep 1.1s ease-in-out infinite; }
.app-splash-hint { font-size: 12px; font-weight: 700; letter-spacing: .5px; color: var(--muted); }

@keyframes splash-spin { to { transform: rotate(360deg); } }
@keyframes splash-pulse { 0%, 100% { transform: scale(1); opacity: .92; } 50% { transform: scale(1.07); opacity: 1; } }
@keyframes splash-sweep { 0% { transform: translateX(-120%); } 100% { transform: translateX(320%); } }

@media (prefers-reduced-motion: reduce) {
  .app-splash-badge img, .app-splash-ring, .app-splash-bar span { animation-duration: 2.4s; }
}

/* ----- Error UI Blazor ----- */
#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000; padding: 12px 18px;
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 700; }
#blazor-error-ui .reload { color: #fff; text-decoration: underline; }
#blazor-error-ui .dismiss { float: right; cursor: pointer; }
/* Stato "in corso" sui bottoni durante l'invio dei form (js/forms.js).
   Spinner in currentColor: leggibile sia sui bottoni pieni (testo bianco)
   sia su quelli chiari (testo scuro). */
.is-loading { pointer-events: none; opacity: .85; cursor: default; }
.is-loading::before {
    content: ""; display: inline-block; vertical-align: -2px;
    width: 13px; height: 13px; margin-right: 7px;
    border: 2px solid currentColor; border-right-color: transparent;
    border-radius: 50%; animation: va-spin .6s linear infinite;
}
@keyframes va-spin { to { transform: rotate(360deg); } }
