/* App per telefono (genitori e istruttrici): titolo grande, liste raggruppate, barra delle schede in vetro,
   fogli dal basso. Pensata per una mano: le azioni stanno nella metà bassa dello schermo. */

body.mobile { background: var(--canvas); overscroll-behavior-y: none; }
.m-app { max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: 100dvh;
  padding: max(10px, env(safe-area-inset-top)) 16px calc(112px + env(safe-area-inset-bottom)); }
.m-screen { display: grid; gap: 22px; animation: m-in .4s var(--spring); }
@keyframes m-in { from { opacity: 0; transform: translateY(8px); } }

/* Intestazione con titolo grande */
.m-head { display: grid; gap: 2px; padding: 8px 4px 0; }
.m-head__top { display: flex; align-items: center; gap: 10px; min-height: 36px; }
.m-head__top .grow { flex: 1; min-width: 0; }
.m-eyebrow { font-size: var(--t-sm); font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.m-title { font-family: var(--font-title); font-size: 34px; font-weight: 750; letter-spacing: -.035em; line-height: 1.08; }
.m-sub { color: var(--muted); font-size: var(--t-base); margin-top: 4px; }
.m-tema { width: 36px; height: 36px; border-radius: 50%; color: var(--ink-2); }
.m-tema svg { width: 21px; height: 21px; }
.m-logo { width: 34px; height: 34px; border-radius: 9px; box-shadow: 0 2px 6px rgb(0 0 0 / .12); }
.m-round { width: 36px; height: 36px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; position: relative;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-tap); text-decoration: none; }
.m-round svg { width: 19px; height: 19px; }

/* Selettore dei figli (segmented a tutta larghezza) */
.m-seg { display: flex; width: 100%; }
.m-seg button { flex: 1; height: 34px; font-size: var(--t-md); }

/* Titolo di sezione e liste raggruppate */
.m-section { display: grid; gap: 8px; }
.m-section > h2 { font-size: 21px; font-weight: 720; letter-spacing: -.025em; padding: 0 4px; display: flex; align-items: baseline; gap: 8px; }
.m-section > h2 small { font-family: var(--font-ui); font-size: var(--t-md); font-weight: 500; color: var(--muted); letter-spacing: -.01em; }
.m-label { font-size: var(--t-sm); color: var(--muted); padding: 0 16px; text-transform: uppercase; letter-spacing: .02em; }
.m-foot { font-size: var(--t-sm); color: var(--muted); padding: 0 16px; line-height: 1.4; }
.ilist { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--r-panel); overflow: hidden; }
.ilist > li, .ilist > a, .ilist > button, .ilist > label { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 16px; position: relative; width: 100%;
  border: 0; background: none; color: inherit; text-align: left; text-decoration: none; font: inherit; }
.ilist > :is(li, a, button, label) + :is(li, a, button, label)::before { content: ""; position: absolute; top: 0; right: 0; left: var(--sep, 16px); border-top: .5px solid var(--line); }
.ilist > :is(a, button):active, .ilist .tap:active { background: var(--sunken-2); }
.ilist .grow { flex: 1; min-width: 0; }
.ilist b { font-weight: 560; display: block; }
.ilist small { display: block; color: var(--muted); font-size: var(--t-sm); margin-top: 1px; }
.ilist .val { color: var(--muted); font-size: var(--t-base); text-align: right; flex: none; max-width: 55%; white-space: nowrap; }
.ilist .val b { color: var(--ink); }
.ilist .tile { --sep: 58px; }
.ilist > li:has(> .tile) ~ li::before, .ilist > :has(> .tile) + :has(> .tile)::before { left: 58px; }

/* Riquadro data (giorno + numero) */
.datebox { --gc: var(--brand); width: 46px; flex: none; display: grid; justify-items: center; line-height: 1; padding: 6px 0 7px; border-radius: 11px;
  background: color-mix(in srgb, var(--gc) 12%, var(--surface)); }
.datebox small { font-size: 10.5px !important; font-weight: 700; color: var(--gc) !important; text-transform: uppercase; letter-spacing: .04em; margin: 0 !important; }
.datebox b { font-family: var(--font-title); font-size: 21px; font-weight: 600 !important; margin-top: 3px; letter-spacing: -.02em; }

/* Hero della prossima lezione (gradiente HorizonX) */
.m-hero { padding: 20px 20px 18px; display: grid; gap: 16px; min-height: 248px; box-shadow: 0 22px 44px -22px rgb(150 10 20 / .7); }
.m-hero__top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.m-hero__top .grow { flex: 1; }
.m-hero__when { display: grid; gap: 4px; align-self: end; }
.m-hero__day { font-size: 52px; }
.m-hero__meta { font-size: var(--t-lg); font-weight: 560; color: rgb(255 255 255 / .92); }
.m-hero__note { font-size: var(--t-sm); color: rgb(255 255 255 / .82); display: flex; gap: 6px; align-items: flex-start; }
.m-hero__note svg { width: 15px; height: 15px; flex: none; margin-top: 1px; }
.m-hero__actions { display: flex; gap: 10px; }
.m-hero__actions .btn { flex: 1; height: 46px; border-radius: 14px; font-size: var(--t-base); }
.m-hero--quiet { min-height: 0; }

/* Card informativa colorata (recuperi, avvisi) */
.m-callout { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--r-panel); background: var(--surface); text-align: left; border: 0; width: 100%; font: inherit; color: inherit; cursor: pointer;
  box-shadow: var(--shadow-tap); transition: transform .25s var(--spring); }
.m-callout:active { transform: scale(.98); }
.m-callout .grow { flex: 1; min-width: 0; }
.m-callout b { display: block; font-weight: 620; }
.m-callout small { color: var(--muted); font-size: var(--t-sm); }
.m-callout__num { font-family: var(--font-display); font-size: 34px; line-height: 1; color: var(--info); min-width: 30px; text-align: center; }


/* Barra delle schede: vetro fluttuante */
.tabbar { position: fixed; z-index: 30; left: 50%; translate: -50% 0; bottom: max(14px, env(safe-area-inset-bottom)); width: min(420px, calc(100vw - 28px));
  display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); padding: 6px; border-radius: 30px;
  background: var(--material); -webkit-backdrop-filter: saturate(200%) blur(24px); backdrop-filter: saturate(200%) blur(24px);
  box-shadow: 0 0 0 .5px var(--line), 0 12px 32px -8px rgb(0 0 0 / .22); }
.tabbar button { border: 0; background: none; height: 52px; border-radius: 24px; display: grid; justify-items: center; align-content: center; gap: 2px;
  font-size: 10.5px; font-weight: 600; color: var(--muted); cursor: pointer; position: relative; transition: color .2s, background .3s var(--spring); }
.tabbar button svg { width: 24px; height: 24px; stroke-width: 1.9; }
.tabbar button[aria-current="page"] { color: var(--brand); background: var(--brand-soft); }
.tabbar .badge { position: absolute; top: 5px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--surface); font-variant-numeric: tabular-nums; }

/* Fogli dal basso: le finestre diventano "sheet" con maniglia */
body.mobile .dialog { top: auto; bottom: 0; left: 0; right: 0; translate: none; width: 100%; max-width: 560px; margin: 0 auto; max-height: 90vh;
  border-radius: 22px 22px 0 0; padding-bottom: env(safe-area-inset-bottom); animation: sheet .5s var(--spring); background: var(--surface); }
body.mobile .dialog::before { content: ""; position: absolute; top: 6px; left: 50%; translate: -50% 0; width: 36px; height: 5px; border-radius: 3px; background: var(--line-strong); }
body.mobile .dialog__head { padding-top: 26px; text-align: center; }
body.mobile .dialog__head h2 { font-size: 21px; }
body.mobile .dialog__body { text-align: left; }
body.mobile .dialog__foot { flex-direction: column-reverse; gap: 8px; padding: 4px 20px 20px; }
body.mobile .dialog__foot .btn { width: 100%; height: 50px; border-radius: 14px; font-size: var(--t-lg); }
body.mobile .dialog__foot .btn--quiet { background: transparent; color: var(--brand); }
body.mobile .scrim { background: rgb(0 0 0 / .32); -webkit-backdrop-filter: none; backdrop-filter: none; }
@keyframes sheet { from { transform: translateY(100%); } }

/* HUD in alto, come le notifiche di sistema */
body.mobile .toasts { top: max(12px, env(safe-area-inset-top)); bottom: auto; }
body.mobile .toast { animation: toast-top .5s var(--spring); }
@keyframes toast-top { from { opacity: 0; transform: translateY(-24px) scale(.9); } }

/* Posti liberi a pallini */
.posti { display: flex; gap: 3px; margin-top: 5px; }
.posti i { width: 8px; height: 8px; border-radius: 50%; background: var(--sunken); }
.posti i.on { background: var(--gc, var(--brand)); }

/* Notifiche */
.m-notif { display: grid; grid-template-columns: 38px 1fr; gap: 12px; padding: 14px 16px; background: var(--surface); border-radius: 20px; }
.m-notif img { width: 38px; height: 38px; border-radius: 9px; }
.m-notif__head { display: flex; align-items: baseline; gap: 8px; }
.m-notif__head b { flex: 1; font-weight: 650; display: flex; align-items: center; gap: 6px; }
.m-notif__head b i { width: 8px; height: 8px; border-radius: 50%; background: var(--info); flex: none; }
.m-notif__head small { color: var(--muted); font-size: var(--t-xs); white-space: nowrap; }
.m-notif p { color: var(--ink-2); font-size: var(--t-md); margin-top: 2px; white-space: pre-line; }

/* Pagina di errore */
.errore-pagina { min-height: 86vh; display: grid; place-items: center; text-align: center; padding: 24px; }
.errore-pagina img { width: 84px; height: 84px; border-radius: 20px; margin: 0 auto 18px; box-shadow: var(--shadow-lift); }
.errore-pagina h1 { font-size: 26px; font-weight: 720; }
.errore-pagina p { color: var(--muted); margin-top: 8px; max-width: 320px; margin-inline: auto; }

/* Regole in fondo, a richiesta */
.m-regole { padding: 0 4px; }
.m-regole summary { cursor: pointer; color: var(--brand); font-weight: 590; font-size: var(--t-md); list-style: none; display: flex; align-items: center; gap: 6px; }
.m-regole summary::-webkit-details-marker { display: none; }
.m-regole summary svg { width: 16px; height: 16px; }
.m-regole ul { margin: 10px 0 0; padding: 14px 16px 14px 32px; background: var(--surface); border-radius: var(--r-panel); color: var(--ink-2); font-size: var(--t-md); display: grid; gap: 8px; }

/* Presenze (app istruttrici): riga intera = interruttore */
.appello > li { min-height: 64px; }
.appello .avatar { width: 40px; height: 40px; font-size: 14px; }
.appello .flags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 4px; }
.appello .is-via b { color: var(--muted); text-decoration: line-through; }

/* Striscia dei giorni (app istruttrici) */
.weeknav { display: flex; align-items: center; gap: 2px; padding: 0 4px 0 6px; margin-bottom: -4px; }
.weeknav .grow { flex: 1; font-size: var(--t-md); font-weight: 620; color: var(--ink); }
.weeknav .btn--icon:disabled { opacity: .3; }
.daystrip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 6px; border-radius: 18px; background: var(--surface); }
.daystrip button { border: 0; background: none; border-radius: 13px; padding: 7px 0 6px; display: grid; justify-items: center; gap: 2px; cursor: pointer; color: var(--ink); transition: background .25s var(--spring); }
.daystrip small { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: capitalize; }
.daystrip b { font-family: var(--font-title); font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.daystrip i { display: flex; gap: 3px; height: 5px; }
.daystrip i span { width: 5px; height: 5px; border-radius: 50%; background: var(--brand); opacity: .7; }
.daystrip button[aria-pressed="true"] { background: var(--brand); color: #fff; }
.daystrip button[aria-pressed="true"] small { color: rgb(255 255 255 / .85); }
.daystrip button[aria-pressed="true"] i span { background: #fff; }

/* Intestazione di una lezione non protagonista */
.m-lez { display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 16px; border-radius: var(--r-panel); background: color-mix(in srgb, var(--gc) 9%, var(--surface)); position: relative; overflow: hidden; }
.m-lez::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--gc); }
.m-lez__ora { font-family: var(--font-display); font-size: 30px; line-height: 1; }
.m-lez .grow { flex: 1; min-width: 0; display: grid; gap: 4px; justify-items: start; }
.m-lez small { color: var(--muted); font-size: var(--t-sm); }
.opzione .gdot { width: 12px; height: 12px; }
