/* OE Copilot sul web. Pensata per la Home dell'iPhone: niente che ricordi una pagina web. */

:root {
  --acc: #5b5fc7;
  --acc2: #7c82f0;
  --acc-soft: rgba(91, 95, 199, .12);
  --on-acc: #fff;
  --testa1: #6d72e8;
  --testa2: #4b4fb8;
  --bg: #f2f3f8;
  --card: #ffffff;
  --card2: #f5f6fa;
  --card3: #eceef5;
  --riga: rgba(20, 22, 40, .07);
  --riga2: rgba(20, 22, 40, .14);
  --tx: #151722;
  --tx2: #565b6b;
  --tx3: #8b90a0;
  --rosso: #e5484d;
  --giallo: #f0a020;
  --verde: #30a46c;
  --vetro: rgba(255, 255, 255, .8);
  --velo: rgba(14, 16, 32, .38);
  --ombra: 0 1px 2px rgba(20, 22, 40, .05), 0 6px 18px rgba(20, 22, 40, .06);
  --ombra-alta: 0 10px 34px rgba(20, 22, 40, .18);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --tondo: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --molla: cubic-bezier(.34, 1.4, .5, 1);
  --barra-h: 64px;
  --ora-h: 60px;
  --testa-h: 0px;
  color-scheme: light;
}

[data-tema="scuro"] {
  --acc: #8e92ff;
  --acc2: #a8abff;
  --acc-soft: rgba(142, 146, 255, .16);
  --on-acc: #0f1030;
  --testa1: #2c2f63;
  --testa2: #17183a;
  --bg: #0b0c11;
  --card: #16181f;
  --card2: #1c1f28;
  --card3: #252935;
  --riga: rgba(255, 255, 255, .07);
  --riga2: rgba(255, 255, 255, .14);
  --tx: #f1f2f6;
  --tx2: #a4a9b8;
  --tx3: #6e7386;
  --rosso: #ff6b6f;
  --giallo: #ffb340;
  --verde: #3dd68c;
  --vetro: rgba(24, 26, 34, .78);
  --velo: rgba(0, 0, 0, .55);
  --ombra: 0 0 0 1px rgba(255, 255, 255, .05);
  --ombra-alta: 0 12px 40px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

[data-densita="compatta"] { --ora-h: 46px; }
[data-densita="ampia"] { --ora-h: 78px; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  color: var(--tx);
  background: var(--bg);
  min-height: 100dvh;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
html.lock, html.lock body { overflow: hidden; }
.selezionabile { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
h1, h2, h3, h4, p { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
input { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
svg { display: block; }
a { color: inherit; text-decoration: none; }
.num { font-family: var(--tondo); font-variant-numeric: tabular-nums; }
.muto { color: var(--tx2); }
.piccolo { font-size: 13px; color: var(--tx3); }
.tronca { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tocco { transition: transform .16s var(--ease), opacity .16s; }
.tocco:active { transform: scale(.975); opacity: .85; }

/* ---------- avvio ---------- */
/* identica alle immagini di avvio dell'iPhone (genera_icone.py): il passaggio non si vede */
.splash { position: fixed; inset: 0; display: grid; place-items: center; background: linear-gradient(180deg, #6d72e8, #4b4fb8); }
.splash img { width: 192px; height: 192px; }
.splash i { position: absolute; left: 50%; top: calc(50% + 92px); width: 26px; height: 26px; margin-left: -13px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .25); border-top-color: #fff; opacity: 0; animation: gira .8s linear infinite, appare .3s .9s forwards; }
@keyframes gira { to { transform: rotate(360deg); } }
@keyframes appare { from { opacity: 0; } to { opacity: 1; } }

/* ---------- intestazione ---------- */
#testa-fondo { position: sticky; top: 0; z-index: 20; background: var(--bg); }
#testa {
  color: #fff;
  background: linear-gradient(160deg, var(--testa1), var(--testa2));
  padding: calc(var(--sat) + 8px) calc(16px + var(--sar)) 12px calc(16px + var(--sal));
  border-radius: 0 0 24px 24px;
  box-shadow: 0 6px 24px rgba(40, 44, 120, .16);
}
[data-tema="scuro"] #testa { box-shadow: 0 1px 0 rgba(255, 255, 255, .06); }
.testa-riga { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 46px; }
.testa-titolo { min-width: 0; }
.testa-titolo h1 { font-size: 30px; font-weight: 800; letter-spacing: -.025em; line-height: 1.08; transition: font-size .3s var(--ease); }
.testa-titolo .sopra { font-size: 13px; font-weight: 650; opacity: .78; letter-spacing: .01em; }
.testa-titolo .sopra::first-letter { text-transform: uppercase; }
#testa.compatta .testa-titolo h1 { font-size: 21px; }
.testa-azioni { display: flex; align-items: center; gap: 8px; flex: none; }
.tondo { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .16); color: #fff; transition: transform .16s var(--ease), background .2s; }
.tondo:active { transform: scale(.92); background: rgba(255, 255, 255, .26); }
.tondo svg { width: 21px; height: 21px; }
.tondo.gira svg { animation: gira .9s linear infinite; }
.pill { height: 34px; padding: 0 14px; border-radius: 17px; background: rgba(255, 255, 255, .18); font-weight: 750; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.pill:active { background: rgba(255, 255, 255, .28); }

.stato-dati { display: flex; align-items: center; gap: 7px; margin-top: 10px; padding: 7px 12px; border-radius: 13px; background: rgba(0, 0, 0, .16); font-size: 13px; font-weight: 600; }
.stato-dati svg { width: 16px; height: 16px; flex: none; }
.stato-dati.errore { background: rgba(229, 72, 77, .32); }

/* striscia dei giorni */
.striscia { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 12px; touch-action: pan-y; }
.striscia .g { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 7px 0 8px; border-radius: 15px; color: rgba(255, 255, 255, .9); transition: background .25s, color .25s, transform .16s var(--ease); }
.striscia .g:active { transform: scale(.94); }
.striscia .g .gs { font-size: 11px; font-weight: 750; opacity: .66; text-transform: uppercase; letter-spacing: .04em; }
.striscia .g .n { font: 750 18px/1 var(--tondo); font-variant-numeric: tabular-nums; }
.striscia .g .pt { display: flex; gap: 3px; height: 5px; }
.striscia .g .pt i { width: 5px; height: 5px; border-radius: 50%; background: rgba(255, 255, 255, .78); }
.striscia .g.oggi .n { color: #ffd76a; }
.striscia .g.sel { background: #fff; color: var(--testa2); }
[data-tema="scuro"] .striscia .g.sel { background: var(--acc); color: var(--on-acc); }
.striscia .g.sel .pt i { background: var(--c, var(--acc)); }
.striscia .g.sel.oggi .n { color: inherit; }
.striscia.va-sx { animation: da-dx .32s var(--ease); }
.striscia.va-dx { animation: da-sx .32s var(--ease); }
@keyframes da-dx { from { opacity: .2; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes da-sx { from { opacity: .2; transform: translateX(-30px); } to { opacity: 1; transform: none; } }

/* ---------- contenuto ---------- */
#contenuto {
  max-width: 720px;
  margin: 0 auto;
  padding: 6px calc(14px + var(--sar)) calc(var(--barra-h) + var(--sab) + 36px) calc(14px + var(--sal));
}
.sez { display: flex; align-items: baseline; justify-content: space-between; padding: 18px 6px 8px; }
.sez h2 { font-size: 13px; font-weight: 750; color: var(--tx3); text-transform: uppercase; letter-spacing: .06em; }
.sez button { font-size: 14px; font-weight: 700; color: var(--acc); }
.vuoto { text-align: center; padding: 48px 20px; color: var(--tx3); }
.vuoto svg { width: 44px; height: 44px; margin: 0 auto 12px; opacity: .5; }
.vuoto b { display: block; color: var(--tx2); font-size: 17px; margin-bottom: 4px; }

/* ---------- agenda ---------- */
.giorno { scroll-margin-top: calc(var(--testa-h) + 4px); }
.giorno-testa {
  position: sticky;
  top: var(--testa-h);
  z-index: 5;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 14px 6px 8px;
  background: var(--bg);   /* pieno: le schede ci scorrono sotto senza trasparire */
}
.giorno-testa b { font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.giorno-testa span { font-size: 13.5px; color: var(--tx3); font-weight: 650; }
.giorno-testa span::first-letter { text-transform: uppercase; }
.giorno-testa .fest { margin-left: auto; font-size: 12px; color: var(--rosso); font-weight: 750; text-align: right; }
.libero { color: var(--tx3); font-size: 14px; padding: 2px 8px 6px; font-weight: 550; }

.evento {
  position: relative;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 12px 12px 12px 0;
  margin-bottom: 8px;
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--ombra);
  overflow: hidden;
  transition: transform .16s var(--ease), opacity .3s;
}
.evento:active { transform: scale(.982); }
.evento::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c); }
.evento .ora { padding-left: 17px; display: flex; flex-direction: column; font: 750 15px/1.2 var(--tondo); font-variant-numeric: tabular-nums; }
.evento .ora span { font-weight: 600; font-size: 12.5px; color: var(--tx3); }
.evento .testo { min-width: 0; }
.evento .titolo { font-weight: 700; font-size: 15.5px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.evento .meta { display: flex; align-items: center; gap: 6px; margin-top: 5px; font-size: 12.5px; color: var(--tx2); min-width: 0; }
.evento .meta .dove { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.evento .meta .dove svg { width: 14px; height: 14px; flex: none; }
.evento .meta .dove span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.evento.passato { opacity: .48; }
.evento.secondario .titolo { color: var(--tx2); }
.evento.adesso { box-shadow: 0 0 0 2px var(--acc), var(--ombra); }
.evento .avanz { position: absolute; left: 5px; bottom: 0; height: 3px; background: var(--acc); border-radius: 0 2px 0 0; }
.evento .badge { position: absolute; top: 9px; right: 12px; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--acc); }

.chip-az { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px 0 3px; border-radius: 11px; background: var(--c-bg); color: var(--c-tx); font-weight: 750; font-size: 11.5px; flex: none; max-width: 150px; }
.chip-az span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg { width: 16px; height: 16px; border-radius: 50%; background: var(--c); color: #fff; display: grid; place-items: center; font: 800 7.5px/1 var(--font); flex: none; }
.sg img { width: 16px; height: 16px; border-radius: 4px; object-fit: contain; background: #fff; }
.sg.logo { background: #fff; }

.partecipa { height: 34px; padding: 0 13px; border-radius: 17px; background: var(--acc); color: var(--on-acc); font-weight: 750; font-size: 13.5px; display: inline-flex; align-items: center; gap: 5px; flex: none; transition: transform .16s var(--ease); }
.partecipa:active { transform: scale(.93); }
.partecipa svg { width: 16px; height: 16px; }
.partecipa.tenue { background: var(--acc-soft); color: var(--acc); }

.tuttogiorno { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.tuttogiorno button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px 7px 8px; border-radius: 13px; font-size: 13px; font-weight: 700; background: var(--c-bg); color: var(--c-tx); max-width: 100%; }
.tuttogiorno button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ancora { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 22px; color: var(--tx3); font-size: 14px; font-weight: 650; }
.ancora i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--riga2); border-top-color: var(--acc); animation: gira .8s linear infinite; }

/* scheletri mentre arrivano i primi dati */
.scheletro { height: 66px; border-radius: 18px; margin-bottom: 8px; background: linear-gradient(90deg, var(--card) 0%, var(--card3) 50%, var(--card) 100%); background-size: 200% 100%; animation: luccica 1.3s linear infinite; }
@keyframes luccica { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---------- calendario (linea del tempo) ---------- */
.cal-tutto { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 0 4px 52px; }
.cal-scorri { position: relative; margin-top: 6px; touch-action: pan-y; }
.cal-griglia { position: relative; margin-left: 52px; height: calc(24 * var(--ora-h)); }
.cal-griglia .h { position: absolute; left: -52px; width: 42px; text-align: right; font: 650 11.5px/1 var(--tondo); color: var(--tx3); transform: translateY(-50%); font-variant-numeric: tabular-nums; }
.cal-griglia .l { position: absolute; left: 0; right: 0; border-top: 1px solid var(--riga); }
.cal-griglia .l.mezza { border-top-style: dashed; opacity: .55; }
.cal-colonne { position: absolute; inset: 0; display: grid; grid-template-columns: var(--colonne, 1fr); }
.cal-col { position: relative; border-left: 1px solid var(--riga); }
.cal-col:first-child { border-left: 0; }
.cal-col.oggi { background: var(--acc-soft); }
.cal-col.weekend { background: rgba(127, 127, 127, .04); }
.blocco {
  position: absolute;
  border-radius: 10px;
  padding: 4px 6px 4px 8px;
  background: var(--c-bg);
  color: var(--c-tx);
  border-left: 4px solid var(--c);
  overflow: hidden;
  font-size: 12.5px;
  line-height: 1.22;
  box-shadow: 0 0 0 1.5px var(--bg);
  transition: transform .16s var(--ease);
}
.blocco:active { transform: scale(.97); }
.blocco b { display: block; font-weight: 750; color: var(--tx); }
.blocco span { display: block; font-size: 11.5px; opacity: .8; }
.blocco.passato { opacity: .55; }
.blocco.secondario { opacity: .75; }
.adesso-linea { position: absolute; left: -6px; right: 0; height: 2px; background: var(--rosso); z-index: 3; pointer-events: none; }
.adesso-linea::before { content: ""; position: absolute; left: 0; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--rosso); }
.cal-intest { display: grid; grid-template-columns: 52px var(--colonne, 1fr); position: sticky; top: var(--testa-h); z-index: 6; background: var(--bg); padding: 8px 0 6px; }
.cal-intest div { text-align: center; font-size: 12px; font-weight: 750; color: var(--tx3); }
.cal-intest div b { display: block; font: 750 19px/1.2 var(--tondo); color: var(--tx); }
.cal-intest div.oggi b { color: var(--acc); }
.cal-slitta-sx { animation: slitta-sx .3s var(--ease); }
.cal-slitta-dx { animation: slitta-dx .3s var(--ease); }
@keyframes slitta-sx { from { opacity: .3; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes slitta-dx { from { opacity: .3; transform: translateX(-40px); } to { opacity: 1; transform: none; } }

/* ---------- liste (calendari, altro) ---------- */
.lista { background: var(--card); border-radius: 20px; overflow: hidden; box-shadow: var(--ombra); }
.voce { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; min-height: 58px; border-bottom: 1px solid var(--riga); }
.voce:last-child { border-bottom: 0; }
.voce .cresce { flex: 1; min-width: 0; }
.voce .nome { font-weight: 700; font-size: 16px; }
.voce .det { font-size: 13px; color: var(--tx3); margin-top: 1px; }
.voce .det.errore { color: var(--rosso); }
.voce .det.avviso { color: var(--giallo); }
.voce .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--c-bg, var(--card3)); color: var(--c, var(--tx2)); flex: none; }
.voce .ico svg { width: 19px; height: 19px; }
.voce .ico img { width: 24px; height: 24px; object-fit: contain; }
.voce .chev { width: 18px; height: 18px; color: var(--tx3); flex: none; }
.voce.rossa .nome { color: var(--rosso); }
.puntino { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--tx3); }
.puntino.ok { background: var(--verde); }
.puntino.avviso { background: var(--giallo); }
.puntino.errore { background: var(--rosso); box-shadow: 0 0 0 4px rgba(229, 72, 77, .18); }

.interruttore { width: 51px; height: 31px; border-radius: 16px; background: var(--riga2); position: relative; transition: background .25s; flex: none; }
.interruttore::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .22); transition: transform .32s var(--molla); }
.interruttore.on { background: var(--verde); }
.interruttore.on::after { transform: translateX(20px); }

.segmenti { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; border-radius: 12px; background: var(--card3); position: relative; }
.segmenti button { height: 32px; border-radius: 9px; font-size: 14px; font-weight: 650; color: var(--tx2); text-align: center; position: relative; z-index: 1; transition: color .2s; }
.segmenti button.on { background: var(--card); color: var(--tx); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
[data-tema="scuro"] .segmenti button.on { background: var(--card2); }
.voce.colonna { flex-direction: column; align-items: stretch; gap: 10px; }

.scheda { background: var(--card); border-radius: 20px; padding: 16px; box-shadow: var(--ombra); }
.scheda.server { display: flex; align-items: center; gap: 12px; }
.scheda.server .grande { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--acc-soft); color: var(--acc); flex: none; }
.scheda.server .grande svg { width: 24px; height: 24px; }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 52px; border-radius: 16px; background: var(--card3); font-weight: 750; font-size: 16px; transition: transform .16s var(--ease), filter .16s; }
.btn:active { transform: scale(.975); filter: brightness(1.05); }
.btn svg { width: 20px; height: 20px; }
.btn.acc { background: var(--acc); color: var(--on-acc); }
.btn.rosso { background: rgba(229, 72, 77, .12); color: var(--rosso); }
.btn.teams { background: #5b5fc7; color: #fff; }
.btn.webex { background: #07805c; color: #fff; }
.btn.zoom { background: #0b5cff; color: #fff; }
.btn.meet { background: #1a73e8; color: #fff; }
.bottoni { display: flex; flex-direction: column; gap: 10px; }
.bottoni.riga { flex-direction: row; }
.bottoni.riga .btn { flex: 1; }

.codice-grande { font: 800 40px/1 var(--tondo); letter-spacing: .12em; text-align: center; padding: 18px 8px; border-radius: 18px; background: var(--card2); }

/* ---------- foglio dal basso ---------- */
.velo { position: fixed; inset: 0; background: var(--velo); opacity: 0; transition: opacity .3s; z-index: 50; }
.velo.su { opacity: 1; }
.foglio {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 51;
  max-height: calc(100dvh - var(--sat) - 18px);
  margin: 0 auto;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: 28px 28px 0 0;
  box-shadow: var(--ombra-alta);
  transform: translateY(105%);
  transition: transform .46s cubic-bezier(.2, .9, .25, 1);
}
.foglio.su { transform: none; }
.foglio.trascina { transition: none; }
.foglio .maniglia { position: absolute; top: 0; left: 0; right: 0; height: 26px; display: grid; place-items: center; z-index: 3; }
.foglio .maniglia i { width: 40px; height: 5px; border-radius: 3px; background: var(--riga2); }
.foglio .chiudi { position: absolute; top: 14px; right: 14px; z-index: 4; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--card3); color: var(--tx2); }
.foglio .chiudi svg { width: 18px; height: 18px; }
.foglio .corpo { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 30px 20px calc(var(--sab) + 26px); display: flex; flex-direction: column; gap: 16px; }
.foglio .corpo > * { flex-shrink: 0; }
.foglio h2 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.18; padding-right: 36px; }
.foglio .banda { height: 6px; width: 54px; border-radius: 3px; background: var(--c); }

.dett { display: flex; flex-direction: column; background: var(--card2); border-radius: 18px; overflow: hidden; }
.dett .d { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-bottom: 1px solid var(--riga); }
.dett .d:last-child { border-bottom: 0; }
.dett .d svg { width: 19px; height: 19px; color: var(--tx3); flex: none; margin-top: 1px; }
.dett .d .cresce { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.dett .d .lab { font-size: 12px; font-weight: 700; color: var(--tx3); text-transform: uppercase; letter-spacing: .05em; }
.dett .d a { color: var(--acc); font-weight: 650; }
.quando { display: flex; flex-direction: column; gap: 2px; }
.quando b { font-size: 17px; font-weight: 750; }
.quando .rel { font-size: 14px; font-weight: 700; color: var(--acc); }

/* ---------- barra delle schede ---------- */
#barra {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: calc(10px + var(--sab));
  transform: translateX(-50%);
  width: min(420px, calc(100% - 24px));
  height: var(--barra-h);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px;
  border-radius: 24px;
  background: var(--vetro);
  -webkit-backdrop-filter: saturate(1.6) blur(22px);
  backdrop-filter: saturate(1.6) blur(22px);
  box-shadow: 0 8px 30px rgba(20, 22, 40, .16), inset 0 0 0 1px var(--riga);
  transition: transform .4s var(--ease), opacity .3s;
}
html.lock #barra { transform: translateX(-50%) translateY(140%); opacity: 0; }
#barra .pillola { position: absolute; top: 6px; bottom: 6px; left: 6px; width: calc((100% - 12px) / 4); border-radius: 18px; background: var(--acc-soft); transform: translateX(calc(var(--i, 0) * 100%)); transition: transform .5s var(--molla); }
#barra button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--tx3); font-size: 11px; font-weight: 750; transition: color .25s; }
#barra button.on { color: var(--acc); }
#barra button svg { width: 24px; height: 24px; transition: transform .4s var(--molla); }
#barra button.on svg { transform: scale(1.08); }
#barra button .pallino { position: absolute; top: 7px; right: calc(50% - 18px); width: 8px; height: 8px; border-radius: 50%; background: var(--rosso); box-shadow: 0 0 0 2px var(--card); }

/* ---------- tira per aggiornare ---------- */
#tira { position: fixed; z-index: 25; left: 50%; top: calc(var(--sat) + 10px); width: 40px; height: 40px; margin-left: -20px; border-radius: 50%; background: var(--card); box-shadow: var(--ombra-alta); display: grid; place-items: center; color: var(--acc); transform: translateY(-80px); opacity: 0; transition: transform .3s var(--ease), opacity .2s; pointer-events: none; }
#tira svg { width: 22px; height: 22px; }
#tira.gira svg { animation: gira .8s linear infinite; }

/* ---------- avvisi ---------- */
.toast { position: fixed; z-index: 70; left: 50%; bottom: calc(var(--barra-h) + var(--sab) + 24px); transform: translate(-50%, 20px); opacity: 0; display: flex; align-items: center; gap: 8px; max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 16px; background: #1d1f2b; color: #fff; font-size: 14.5px; font-weight: 650; box-shadow: var(--ombra-alta); transition: transform .35s var(--molla), opacity .25s; }
.toast.su { transform: translate(-50%, 0); opacity: 1; }
.toast svg { width: 18px; height: 18px; flex: none; }
[data-tema="scuro"] .toast { background: #f1f2f6; color: #151722; }

/* ---------- accesso ---------- */
.accesso { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: calc(var(--sat) + 30px) 26px calc(var(--sab) + 30px); background: linear-gradient(160deg, var(--testa1), var(--testa2)); color: #fff; }
.accesso form { width: 100%; max-width: 360px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; text-align: center; }
.accesso img { width: 88px; height: 88px; border-radius: 22px; margin: 0 auto 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.accesso h1 { font-size: 32px; font-weight: 800; letter-spacing: -.025em; }
.accesso p { font-size: 15.5px; opacity: .82; line-height: 1.45; }
.accesso input { height: 64px; border-radius: 18px; border: 2px solid transparent; background: rgba(255, 255, 255, .14); color: #fff; font: 800 26px/1 var(--tondo); letter-spacing: .16em; text-align: center; outline: none; width: 100%; text-transform: uppercase; -webkit-user-select: text; user-select: text; }
.accesso input::placeholder { color: rgba(255, 255, 255, .35); letter-spacing: .1em; }
.accesso input:focus { border-color: rgba(255, 255, 255, .6); background: rgba(255, 255, 255, .2); }
.accesso button[type="submit"] { height: 56px; border-radius: 18px; background: #fff; color: var(--testa2); font-weight: 800; font-size: 17px; transition: transform .16s var(--ease), opacity .2s; }
.accesso button[type="submit"]:active { transform: scale(.97); }
.accesso button[disabled] { opacity: .6; }
.accesso .errore { min-height: 21px; color: #ffd0d0; font-weight: 700; font-size: 14.5px; }
.accesso .consiglio { margin-top: 10px; padding: 14px; border-radius: 16px; background: rgba(0, 0, 0, .18); font-size: 14px; text-align: left; line-height: 1.45; display: flex; gap: 10px; }
.accesso .consiglio svg { width: 22px; height: 22px; flex: none; margin-top: 1px; }

/* ---------- PC: barra laterale ---------- */
@media (min-width: 900px) {
  body { padding-left: calc(96px + var(--sal)); }
  #testa { border-radius: 0 0 24px 24px; margin-right: 14px; }
  #contenuto { max-width: 860px; padding: 6px 28px 40px 14px; }
  #contenuto[data-vista="calendario"] { max-width: none; margin: 0; }
  #barra {
    left: calc(14px + var(--sal));
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    width: 72px;
    height: auto;
    grid-template-columns: 1fr;
    grid-auto-rows: 66px;
  }
  html.lock #barra { transform: translateY(-50%); opacity: 1; }
  #barra .pillola { top: 6px; bottom: auto; left: 6px; right: 6px; width: auto; height: 66px; transform: translateY(calc(var(--i, 0) * 100%)); }
  .toast { bottom: 28px; }
  .foglio { bottom: auto; top: 50%; border-radius: 28px; max-height: 86vh; width: 560px; left: 50%; right: auto; transform: translate(-50%, -46%) scale(.96); opacity: 0; transition: transform .32s var(--ease), opacity .22s; }
  .foglio.su { transform: translate(-50%, -50%); opacity: 1; }
  .foglio .maniglia { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
