/* ==========================================================================
   Power Hour – ITS Alto Adriatico
   Foglio di stile unico (versione desktop, ruoli: studente, docente, admin)
   Base di progetto: 1920 × 1080  →  1rem = 16px a 1920px di larghezza
   ========================================================================== */

/* ---------- 1. Token ---------- */
:root {
  --red: #c51821;
  --red-dark: #7b1318;
  --red-soft: #fbbcbc;
  --red-soft-2: #f0c0c0;
  --ink: #16201d;
  --ink-2: #2b3532;
  --muted: #66726e;
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #f4f6f5;
  --line: #dfe4e2;
  --line-strong: #c9cdcb;
  --chip: #d9d9d9;
  --chip-text: #111;
  --green: #2bff00;
  --green-text: #18e000;
  --green-btn: #23825c;
  --green-soft: #dff3e8;
  --green-ink: #1f7a4d;
  --purple: #b800c4;
  --yellow: #ffe100;
  --shadow: 0 1px 5px rgba(20, 30, 28, .12);
  --shadow-lg: 0 8px 30px rgba(20, 30, 28, .22);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-login: 'Montserrat', 'Inter', system-ui, sans-serif;
  --font-form: 'Work Sans', 'Inter', system-ui, sans-serif;
  --sidebar: 20.2rem;
}

html[data-theme="dark"] {
  --ink: #eef2f0;
  --ink-2: #d5dcd9;
  --muted: #9aa8a3;
  --bg: #111615;
  --surface: #1b2220;
  --surface-2: #232b29;
  --line: #2d3734;
  --line-strong: #4a5551;
  --chip: #2f3835;
  --chip-text: #eef2f0;
  --red-soft: #4b1b1f;
  --red-soft-2: #5a2024;
  --green-soft: #173626;
  --green-ink: #65d9a0;
  --shadow: 0 1px 5px rgba(0, 0, 0, .5);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, .6);
}
html[data-theme="dark"] .donut text[fill="#000"],
html[data-theme="dark"] .donut text[fill="#111"] { fill: #fff; }
html[data-theme="dark"] .donut text[fill="#5b6764"] { fill: #b3bfba; }
html[data-theme="dark"] .qr { background: #fff; padding: .6rem; border-radius: .5rem; color: #000; }
html[data-theme="dark"] .nav-item.is-active { color: #ff8a90; }

html[data-contrast="high"] {
  --muted: #3a4541;
  --line: #8a9490;
  --line-strong: #5d6763;
}
html[data-theme="dark"][data-contrast="high"] { --muted: #d0dad6; --line: #7d8a85; --line-strong: #a3b0ab; }

/* ---------- 2. Reset e base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: clamp(13px, .8334vw, 17px); -webkit-text-size-adjust: 100%; }
html[data-text="large"] { font-size: clamp(14.5px, .94vw, 19px); }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.35; -webkit-font-smoothing: antialiased; }
body.modal-open { overflow: hidden; }
h1, h2, h3, h4, p, ul, dl, dd, figure { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #1a73e8; outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.icon { display: inline-flex; width: 1.6em; height: 1.6em; flex: none; }
.icon svg { width: 100%; height: 100%; }

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.fld-set { margin-top: .9rem; }
legend { padding: 0; }

/* ---------- 3. Layout app ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; z-index: 5;
  background: var(--surface); border-right: 2px solid var(--line);
  box-shadow: 2px 0 4px rgba(0, 0, 0, .06);
  padding: 1.3rem 1.05rem;
  display: flex; flex-direction: column;
}
.brand { display: block; }
.brand-logo { display: block; aspect-ratio: 536 / 110; overflow: hidden; }
.brand-logo img { width: 100%; height: auto; }
.nav { margin-top: 19.75rem; }
.nav-list { display: flex; flex-direction: column; gap: 1.25rem; }
.nav-item {
  display: flex; align-items: center; gap: 1rem; height: 3.6rem; padding: 0 1.7rem;
  border: 1px solid var(--line-strong); border-radius: .95rem;
  background: var(--surface); color: var(--muted); font-size: 1.2rem; font-weight: 500;
  transition: background-color .15s, color .15s, border-color .15s;
}
.nav-item .icon { width: 1.95rem; height: 1.95rem; }
.nav-item:hover { background: var(--surface-2); }
.nav-item.is-active { background: var(--red-soft); color: var(--red); border-color: var(--red-soft-2); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 100vh; }
.topbar { display: flex; align-items: center; justify-content: space-between; height: 7.75rem; padding: 0 3.2rem 0 3.6rem; flex: none; }
.page-title { font-size: 2.75rem; font-weight: 500; letter-spacing: -.01em; }
.page-title--bold { font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 4.6rem; }
.bell { position: relative; display: inline-flex; color: #4a5753; }
html[data-theme="dark"] .bell { color: #c5cfcb; }
.bell .icon { width: 2.5rem; height: 2.5rem; }
.bell-dot { position: absolute; top: .1rem; right: .25rem; width: .7rem; height: .7rem; background: var(--yellow); border-radius: 50%; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 4.6rem; height: 4.6rem; border-radius: 50%; background: var(--red-dark); color: #fff; font-weight: 700; font-size: 1.5rem; }
.avatar--xl { width: 6.3rem; height: 6.3rem; font-size: 2.2rem; flex: none; }

.content { flex: 1; padding: 0 6rem 2.5rem 3.6rem; }
.content--home { padding-right: 9rem; }

.partial-error { padding: 1rem; margin: 1rem; background: #fff3cd; color: #664d03; border-radius: .5rem; font-size: .9rem; }
.sidebar .partial-error { font-size: .75rem; }

.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding: 1.1rem 3.2rem 1.4rem 3.6rem; margin-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
.footer-links { display: flex; gap: 1.8rem; }
.footer-links a:hover { color: var(--red); text-decoration: underline; }

/* ---------- 4. Componenti base ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 1.1rem; box-shadow: var(--shadow); }
.link-red { color: var(--red); font-weight: 700; font-size: 1.25rem; }
.link-red:hover { text-decoration: underline; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 1.9rem 1.5rem 2.9rem 0; }
.section-head h2 { font-size: 2.2rem; font-weight: 600; }
.section-title { font-size: 2.1rem; font-weight: 400; margin: 1.6rem 0 1.1rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .6rem; min-height: 2.7rem; padding: .5rem 1.4rem; border-radius: .6rem; font-size: 1rem; font-weight: 600; border: 1px solid transparent; transition: filter .15s, background-color .15s; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--red { background: var(--red); color: #fff; box-shadow: 0 2px 4px rgba(197, 24, 33, .35); }
.btn--red:hover:not(:disabled) { filter: brightness(1.1); }
.btn--green { background: var(--green-btn); color: #fff; box-shadow: 0 2px 4px rgba(35, 130, 92, .4); }
.btn--ghost { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: var(--line); }
.btn--gray { background: var(--chip); color: var(--chip-text); border-radius: .5rem; font-weight: 400; font-size: 1.2rem; min-height: 2.9rem; }
.btn--gray .icon { width: 1.4rem; height: 1.4rem; }
.btn--square { width: 4.2rem; min-height: 2.9rem; padding: 0; border-radius: .7rem; }
.btn--square .icon { width: 1.6rem; height: 1.6rem; }
.btn--wide { width: 100%; min-height: 3.3rem; font-size: 1.15rem; font-weight: 400; border-radius: .6rem; }
.icon-btn { display: inline-flex; padding: .25rem; border-radius: .4rem; color: var(--ink); }
.icon-btn .icon { width: 1.5rem; height: 1.5rem; }
.icon-btn:hover { background: rgba(0, 0, 0, .08); }
.btn-arrow { display: inline-flex; align-items: center; justify-content: center; width: 2.3rem; height: 2.3rem; border-radius: .5rem; background: var(--red); color: #fff; flex: none; }
.btn-arrow .icon { width: 1.4rem; height: 1.4rem; }

.badge { display: inline-block; padding: .2rem .7rem; border-radius: 999px; font-size: .72rem; font-weight: 700; background: #e8eae9; color: #5b6764; white-space: nowrap; }
.badge--present { background: var(--green-soft); color: var(--green-ink); }
html[data-theme="dark"] .badge { background: #2d3734; color: #b3bfba; }
html[data-theme="dark"] .badge--present { background: var(--green-soft); color: var(--green-ink); }

/* Grafici */
.ring { width: 100%; height: auto; }
.donut { width: 100%; height: auto; }

.dots { display: flex; justify-content: center; gap: .55rem; }
.dot { width: 1rem; height: 1rem; border-radius: 50%; background: var(--chip); transition: background-color .15s; }
.dot.is-active { background: var(--red); }

/* Barre presenze */
.att { display: flex; align-items: center; gap: 1.9rem; width: 100%; padding: 0 .4rem; }
.att-donut { width: 13.4rem; flex: none; }
.att-bars { flex: 1; display: flex; flex-direction: column; gap: 1.2rem; min-width: 0; }
.bar-head { display: flex; justify-content: space-between; font-size: .72rem; font-weight: 700; margin-bottom: .2rem; }
.bar-head span:last-child { font-size: .62rem; font-weight: 600; }
.bar-track { height: 1.45rem; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; min-width: .9rem; }
.bar--ok .bar-track { background: #e0ffd8; } .bar--ok .bar-fill { background: var(--green); }
.bar--ko .bar-track { background: #ffd9d9; } .bar--ko .bar-fill { background: #ff0000; }
.bar--rest .bar-track { background: #ececec; } .bar--rest .bar-fill { background: #d9d9d9; }
html[data-theme="dark"] .bar--ok .bar-track { background: #1c3a17; }
html[data-theme="dark"] .bar--ko .bar-track { background: #4a1f1f; }
html[data-theme="dark"] .bar--rest .bar-track { background: #2d3734; }

/* ---------- 5. Home ---------- */
.home-grid { display: grid; grid-template-columns: 1.67fr 1fr; gap: 4.9rem; margin-top: 2.8rem; }
.home-card { height: 22.4rem; padding: 1.1rem 2rem 1.3rem; position: relative; display: flex; flex-direction: column; }
.home-card .slides { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.slide { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.slide[hidden] { display: none !important; }
.card-head { display: flex; align-items: center; justify-content: space-between; min-height: 2.4rem; }
.card-head h2 { font-size: 1.8rem; font-weight: 500; }
.slide-body { flex: 1; display: flex; align-items: center; justify-content: center; }
.home-card .dots { padding-top: .2rem; }

.room-card { height: 22.4rem; padding: 2.4rem; display: flex; flex-direction: column; justify-content: center; }
.room-card .eyebrow { font-size: 1.35rem; font-weight: 600; color: var(--muted); }
.room-card .room { font-size: 3.7rem; font-weight: 700; color: var(--purple); line-height: 1.15; margin: .1rem 0; }
.room-card .where { font-size: 1.35rem; color: var(--muted); font-weight: 400; }

.lessons { display: grid; grid-template-columns: 1fr 1fr; gap: 4.4rem; margin-right: 1.5rem; }
.lesson { padding: 1rem 1.2rem .9rem; border-radius: .7rem; box-shadow: 0 2px 3px rgba(0, 0, 0, .18); height: 8.3rem; display: flex; flex-direction: column; }
.lesson-top { display: flex; justify-content: space-between; align-items: center; }
.lesson h3 { font-size: 1.4rem; font-weight: 600; }
.lesson-teacher { font-size: 1.05rem; margin-top: .55rem; }
.lesson-time { font-size: .95rem; color: var(--muted); margin-top: auto; }

/* Voti: slide "Ultimi voti" */
.grades-slide { display: grid; grid-template-columns: 17rem 1fr; gap: 3rem; align-items: center; width: 100%; }
.big-ring { width: 14.3rem; margin: 0 auto; }
.last-grades h3 { font-size: 1.4rem; font-weight: 700; text-align: center; margin-bottom: 1rem; }
.last-grades-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem 1rem; }
.mini { display: flex; flex-direction: column; align-items: center; gap: .35rem; font-size: .85rem; text-align: center; }
.mini .ring { width: 4.6rem; }

/* Lezione di oggi (docente) */
.lesson-today { padding: 1.1rem 1.3rem 1.3rem; height: 22.4rem; display: flex; flex-direction: column; }
.lesson-today .card-head h2 { font-size: 1.8rem; }
.lt-body { flex: 1; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1.5rem; padding: 0 .6rem; }
.lt-info h3 { font-size: 1.6rem; font-weight: 600; }
.lt-info p { font-size: .9rem; margin-top: .4rem; }
.lt-info p + p { color: var(--muted); margin-top: .3rem; }
.lt-badge { text-align: center; max-width: 16rem; }
.lt-badge strong { display: block; font-size: 1.45rem; font-weight: 700; color: #c00000; line-height: 1.2; }
.nfc { display: inline-flex; align-items: center; justify-content: center; width: 4.2rem; height: 4.2rem; margin-top: .9rem; border-radius: 50%; border: 1px solid #d9d9d9; background: #f6f6f6; color: #c00000; box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.nfc .icon { width: 2rem; height: 2rem; }
.lt-room { text-align: left; justify-self: end; min-width: 12rem; }
.lt-room .eyebrow { font-size: 1rem; font-weight: 600; color: var(--muted); }
.lt-room .room { font-size: 2.6rem; font-weight: 700; color: var(--purple); line-height: 1.15; }
.lt-room .where { font-size: .95rem; color: var(--muted); }
.lt-actions { display: flex; gap: 2.8rem; }
.lt-actions .btn { flex: 1; min-height: 3rem; font-size: 1.3rem; font-weight: 400; border-radius: .6rem; }
.lt-actions .btn--start { background: var(--red); color: #fff; flex: 1; box-shadow: 0 3px 3px rgba(0, 0, 0, .25); }
.btn--qr { background: #8c9693; color: #fff; flex: 0 0 31%; box-shadow: 0 3px 3px rgba(0, 0, 0, .25); }
html[data-theme="dark"] .btn--qr { background: #3a4542; color: #cfd8d4; }
.btn--qr:hover { filter: brightness(.95); }

.qr-wrap { display: flex; justify-content: center; padding: 1.4rem 0 .6rem; }
.qr { width: 16rem; height: 16rem; color: #000; }

/* ---------- 6. Voti / Presenze (studente) ---------- */
.card-title { font-size: 1.55rem; font-weight: 500; }
.grades-top { padding: 1.6rem 2.2rem 1.8rem; display: grid; grid-template-columns: 14rem 1fr; gap: 6rem; align-items: center; }
.grades-top .big-ring { width: 14rem; }
.grades-top .last-grades h3 { text-align: left; font-size: 1.55rem; margin-bottom: 1rem; }
.grades-top .last-grades-grid { grid-template-columns: repeat(7, 1fr); gap: 1rem; }
.grades-top .mini { color: var(--green-text); font-size: .62rem; }
.grades-top .mini .ring { width: 5.2rem; }

.subjects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.6rem 4.8rem; margin-bottom: 1rem; }
.subject { display: flex; align-items: center; gap: .6rem; padding: .9rem 1rem .9rem 1.1rem; border-radius: .9rem; text-align: left; width: 100%; min-height: 7rem; transition: box-shadow .15s, transform .15s; }
.subject:hover { box-shadow: 0 4px 14px rgba(0, 0, 0, .18); }
.subject-txt { flex: 1; display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.subject-txt strong { font-size: 1.15rem; font-weight: 700; line-height: 1.2; }
.subject-txt small { font-size: .75rem; color: var(--muted); }
.subject-ring { width: 5.2rem; flex: none; }
.subject-chev { width: 1.2rem; height: 1.2rem; color: #5b6764; }

.att-grid { display: grid; grid-template-columns: 1.67fr 1fr; gap: 3rem; margin-bottom: .6rem; }
.att-card { padding: 1rem 1.6rem 1.2rem; min-height: 22.4rem; display: flex; flex-direction: column; }
.att-card #att { flex: 1; display: flex; align-items: center; }
.att-card .card-title { margin-bottom: .2rem; }
.att-card .att-donut { width: 13.4rem; }
.min-card { padding: 2rem 1.8rem; display: flex; flex-direction: column; justify-content: center; }
.min-card .eyebrow { font-size: 1.5rem; color: var(--muted); }
.min-card .big { font-size: 5rem; font-weight: 800; color: #0a1330; line-height: 1.15; margin: .3rem 0; }
html[data-theme="dark"] .min-card .big { color: #fff; }
.min-card .where { font-size: 1.5rem; color: var(--muted); }
.course-card { padding: 1rem 1.6rem 1.2rem; min-height: 22.4rem; display: flex; flex-direction: column; align-items: center; }
.course-card #course-status { flex: 1; display: flex; align-items: center; }
.course-card .card-title { align-self: flex-start; }
.course-card .donut { width: 12.5rem; }

/* ---------- 7. Calendario ---------- */
.cal-head { display: flex; align-items: flex-start; justify-content: space-between; margin: -.6rem 0 .8rem; padding: 0 .1rem; }
.cal-year { font-size: 2.45rem; font-weight: 700; margin-left: 1.4rem; }
.cal-nav { display: flex; align-items: center; gap: .9rem; font-size: .95rem; margin-left: 1.4rem; margin-top: .3rem; }
.cal-nav button { padding: .1rem .5rem; font-size: 1.1rem; line-height: 1; border-radius: .3rem; }
.cal-nav button:hover { background: var(--line); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-left: 1px solid #a7adab; border-top: 0; background: var(--surface); }
.cal-dow { background: var(--chip); color: var(--chip-text); border: 1px solid #111; border-left: 0; font-size: .85rem; font-weight: 500; text-align: center; padding: .2rem 0 .85rem; }
html[data-theme="dark"] .cal-dow { border-color: #5d6763; }
.cal-dow:first-child { border-left: 1px solid #111; }
.cal-cell { min-height: 9.8rem; border-right: 1px solid #a7adab; border-bottom: 1px solid #a7adab; padding: .55rem .6rem .5rem; display: flex; flex-direction: column; align-items: center; cursor: pointer; transition: background-color .12s; }
.cal-cell:hover { background: var(--surface-2); }
.cal-num { font-size: 1.55rem; font-weight: 600; line-height: 1.1; }
.cal-sub { font-size: .55rem; color: #8a9490; width: 85%; text-align: center; border-bottom: 1px solid #b5bab8; padding-bottom: .15rem; margin-bottom: .45rem; }
.cal-acts { width: 100%; display: flex; flex-direction: column; gap: .5rem; }
.chip { display: flex; align-items: stretch; background: var(--chip); color: var(--chip-text); border-radius: .4rem; font-size: .68rem; font-weight: 700; min-height: 1.5rem; }
.chip-time { flex: none; display: flex; align-items: center; padding: 0 .45rem; border-right: 1px solid #8f8f8f; font-weight: 500; font-size: .62rem; }
.chip-name { display: flex; align-items: center; padding: 0 .45rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-cell.is-out .cal-num, .cal-cell.is-out .cal-sub { color: #bdbfbe; }
.cal-cell.is-out .chip { opacity: .4; }
.cal-cell.is-today { background: #fff6f6; box-shadow: inset 0 0 0 2px var(--red); }
html[data-theme="dark"] .cal-cell.is-today { background: #2a1b1d; }

/* Popup giorno */
.day-head { text-align: center; padding: 0 1rem; }
.day-num { font-size: 2.9rem; font-weight: 600; line-height: 1.1; }
.day-sub { font-size: .8rem; color: #8a9490; padding: .3rem 0 .6rem; margin: 0 1.2rem; border-bottom: 1px solid #b5bab8; }
.act-list { display: flex; flex-direction: column; gap: 1.5rem; margin: 2.4rem 0 0; }
.act-row { display: flex; align-items: center; background: var(--chip); color: var(--chip-text); border-radius: .5rem; min-height: 3.2rem; font-weight: 600; font-size: 1.2rem; }
.act-time { flex: none; padding: 0 1rem; width: 10.5rem; border-right: 1px solid #8f8f8f; font-size: 1.05rem; font-weight: 600; line-height: 2.2; }
.act-name { flex: 1; padding: 0 1rem; font-size: 1.3rem; font-weight: 600; }
.act-tools { display: inline-flex; gap: .3rem; padding-right: .6rem; }
.act-empty { text-align: center; color: var(--muted); padding: 1rem; font-size: 1rem; }
.day-add { display: flex; justify-content: center; margin-top: 1.8rem; padding-top: 1.8rem; border-top: 1px solid #b5bab8; }
.day-add .btn { box-shadow: 0 3px 5px rgba(197, 24, 33, .4); }

/* ---------- 8. Voti docente ---------- */
.muted-title { font-size: 1.35rem; color: var(--ink-2); font-weight: 400; margin: .4rem 0 1.8rem; }
.grades-layout { display: grid; grid-template-columns: 22rem minmax(0, 1fr); gap: 4.3rem; align-items: start; }
.acc { display: flex; flex-direction: column; gap: .75rem; }
.acc-item { background: var(--surface); border: 1px solid var(--line); border-radius: .8rem; box-shadow: var(--shadow); overflow: hidden; }
.acc-head { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 0 .9rem; height: 3.1rem; font-weight: 700; font-size: 1.1rem; }
.acc-head .icon { width: 1.3rem; height: 1.3rem; }
.acc-list { padding: 0 .4rem .4rem; display: flex; flex-direction: column; gap: .25rem; }
.acc-student { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 0 .6rem .0 .8rem; height: 2.8rem; border-radius: .6rem; border: 1px solid var(--line); font-weight: 700; font-size: 1.05rem; text-align: left; }
.acc-student:hover { background: var(--surface-2); }
.acc-student.is-active { background: #ffd2d2; border-color: #f2b0b0; color: #111; }
html[data-theme="dark"] .acc-student.is-active { background: #5a2024; color: #fff; }
.acc-student .ring { width: 1.7rem; }
.acc-student .ring text { font-size: 28px; }
.panel { background: var(--surface); border-radius: .9rem; padding: 1.7rem 1.7rem 2rem; min-height: 40rem; box-shadow: var(--shadow); }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1rem; }
.panel-head h2 { font-size: 1.65rem; font-weight: 700; }
.panel .subjects { grid-template-columns: repeat(2, 1fr); gap: 1.4rem 5rem; padding: 0 1.2rem; }
.panel .subject { min-height: 6.9rem; }
.panel-empty { color: var(--muted); padding: 2rem 1.2rem; }

/* ---------- 9. Notifiche ---------- */
.notif-tools { display: flex; justify-content: flex-end; margin: 0 0 .2rem; }
.link-btn { color: var(--red); font-weight: 700; font-size: 1rem; padding: .3rem .5rem; border-radius: .4rem; }
.link-btn:hover:not(:disabled) { text-decoration: underline; }
.link-btn:disabled { color: var(--muted); cursor: default; }
.notif-group { margin-bottom: 1.8rem; }
.notif-day { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1rem; }
.notif-day h2 { font-size: 1.35rem; font-weight: 400; }
.notif-day--lg h2 { font-size: 2.1rem; font-weight: 400; }
.notif-day span { color: var(--red); font-size: .75rem; font-weight: 800; }
.notif { display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 1.5rem; padding: 1.2rem 1.4rem; margin-bottom: 1.3rem; border-radius: .9rem; cursor: pointer; }
.notif.is-read { background: #e6e6e6; box-shadow: var(--shadow); }
html[data-theme="dark"] .notif.is-read { background: #262e2c; }
.notif-ico { display: inline-flex; align-items: center; justify-content: center; width: 3.6rem; height: 3.6rem; border-radius: 50%; }
.notif-ico .icon { width: 1.8rem; height: 1.8rem; }
.notif-ico--aula { background: #f4d4b8; color: #ff8a00; }
.notif-ico--voto { background: #dff3e8; color: #19e000; }
.notif-txt h3 { font-size: 1.25rem; font-weight: 700; }
.notif-txt p { font-size: .8rem; color: var(--muted); margin-top: .3rem; max-width: 24rem; }
.notif time { font-size: .8rem; color: var(--muted); }
.notif-empty { color: var(--muted); font-size: .95rem; }

/* ---------- 10. Profilo ---------- */
.profile { max-width: 100%; }
.profile-card { display: flex; align-items: center; gap: 1.7rem; padding: 1.5rem 1.8rem; border-radius: 1rem; margin-top: .2rem; }
.profile-card h2 { font-size: 1.8rem; font-weight: 700; }
.profile-card p { color: var(--muted); font-size: 1.1rem; margin-top: .2rem; }
.set-title { font-size: 1.1rem; font-weight: 500; color: var(--muted); margin: .7rem 0 .5rem; }
.set-list { display: flex; flex-direction: column; gap: .9rem; }
.set-row { width: 100%; display: flex; align-items: center; gap: 1.1rem; padding: 0 1.2rem; height: 4.8rem; background: var(--surface); border: 1px solid var(--line); border-radius: .9rem; box-shadow: var(--shadow); text-align: left; }
.set-row:hover { background: var(--surface-2); }
.set-ico { display: inline-flex; align-items: center; justify-content: center; width: 2.4rem; height: 2.4rem; border-radius: .6rem; background: var(--surface-2); flex: none; border: 1px solid var(--line); }
.set-ico .icon { width: 1.3rem; height: 1.3rem; }
.set-label { flex: 1; font-weight: 700; font-size: 1.15rem; }
.set-val { color: var(--muted); font-size: 1rem; }
.set-chev { width: 1rem; height: 1rem; color: var(--muted); }
.switch { width: 3.1rem; height: 1.7rem; border-radius: 999px; background: #bdbdbd; position: relative; transition: background-color .2s; flex: none; }
.switch i { position: absolute; top: .2rem; left: .2rem; width: 1.3rem; height: 1.3rem; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s; }
.switch.is-on { background: var(--red); }
.switch.is-on i { transform: translateX(1.4rem); }

/* ---------- 11. Admin ---------- */
.carousel { position: relative; padding: 0 3.2rem; margin-top: 2.8rem; }
.carousel-viewport { overflow: hidden; padding: 4px 4px 8px; margin: -4px; }
.carousel-track { display: flex; gap: 2.6rem; transition: transform .35s ease; }
.course-att { flex: 0 0 calc((100% - 2.6rem) / 2); padding: 1.1rem 1.3rem 1.2rem; height: 19.8rem; }
.course-att .card-head h2 { font-size: 1.15rem; font-weight: 600; }
.course-att .card-head .btn-arrow { width: 1.8rem; height: 1.8rem; border-radius: .45rem; }
.course-att .card-head .btn-arrow .icon { width: 1.1rem; height: 1.1rem; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1.8rem; margin-top: .6rem; }
.pair-item h3 { font-size: .85rem; font-weight: 500; margin-bottom: .5rem; }
.pair-item .ring { width: 8rem; margin: 0 auto; }
.pair-item .ring text { font-weight: 400; font-size: 25px; fill: var(--ink); }
.pair-item p { font-size: .7rem; color: var(--muted); margin-top: .7rem; }
.car-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 2.4rem; height: 3rem; display: inline-flex; align-items: center; justify-content: center; border-radius: .5rem; }
.car-btn:hover:not(:disabled) { background: var(--line); }
.car-btn:disabled { opacity: .25; cursor: default; }
.car-btn .icon { width: 1.5rem; height: 1.5rem; }
.car-btn--prev { left: -.4rem; } .car-btn--next { right: -.4rem; }
.carousel + .dots { margin-top: 1.4rem; }
.dots--sm .dot { width: .8rem; height: .8rem; }

.search-bar { display: flex; align-items: center; gap: .6rem; width: 41rem; margin: 1.2rem auto 2.6rem; padding: .5rem .6rem; background: var(--surface); border-radius: .7rem; box-shadow: var(--shadow); }
.search-bar input { flex: 1; min-width: 0; height: 2rem; padding: 0 .5rem; background: #e8e8e8; border: 1px solid #c3c6c5; border-radius: .25rem; font-size: .95rem; }
html[data-theme="dark"] .search-bar input { background: #232b29; border-color: #3d4744; }
.search-bar input::placeholder { color: #9aa09e; }
.filter-btn { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border: 1px solid #9aa09e; border-radius: .25rem; color: #4a5753; position: relative; }
.filter-btn .icon { width: 1.2rem; height: 1.2rem; }
.filter-btn.has-filters::after { content: ''; position: absolute; top: -.25rem; right: -.25rem; width: .65rem; height: .65rem; border-radius: 50%; background: var(--red); }
.search-bar .btn--red { min-height: 2rem; padding: 0 1rem; gap: 1rem; font-size: .85rem; font-weight: 400; border-radius: .35rem; box-shadow: none; }
.search-bar .btn--red .icon { width: 1.15rem; height: 1.15rem; color: #111; }

.table-card { padding: 1.6rem 1.1rem 1.4rem; border-radius: 1rem; min-height: 38rem; }
.table-head, .table-row { display: grid; grid-template-columns: 1.2fr 1.3fr 1fr .5fr; align-items: center; padding: 0 1.1rem; }
.table-head { font-size: .95rem; color: var(--muted); font-weight: 500; padding-bottom: 1.1rem; border-bottom: 1px solid var(--line); margin-top: 1.4rem; }
.table-head span:last-child, .table-row .t-grade { text-align: center; }
.table-row { height: 7.8rem; border-bottom: 1px solid var(--line); }
.table-row:last-child { border-bottom: 0; }
.t-name { font-size: 1.3rem; font-weight: 700; }
.t-course { font-size: 1.3rem; font-weight: 700; }
.t-att small { display: block; font-size: .72rem; color: var(--muted); margin-bottom: .35rem; }
.t-bar { width: 19.5rem; height: .6rem; background: #ff0000; border-radius: 0; overflow: hidden; }
.t-bar i { display: block; height: 100%; background: var(--green); }
.t-grade { font-size: 1.5rem; font-weight: 700; }
.table-empty { text-align: center; color: var(--muted); padding: 4rem 1rem; font-size: 1.1rem; }

.circ-tools { display: flex; justify-content: flex-end; margin: 0 -.2rem 1.4rem; }
.btn--white { background: var(--surface); color: var(--ink); border-radius: .5rem; box-shadow: var(--shadow); font-size: .85rem; min-height: 2.5rem; font-weight: 700; }
.circ-list { display: flex; flex-direction: column; gap: 1.4rem; }
.circ { padding: 1.5rem 1.3rem 1.3rem 1.6rem; border-radius: 1rem; }
.circ-top { display: flex; align-items: flex-start; justify-content: space-between; }
.circ h3 { font-size: 1.35rem; font-weight: 700; }
.circ .meta { color: var(--muted); font-size: .8rem; margin: .5rem 0 1.1rem; }
.circ .body { font-size: .9rem; }
.circ-actions { display: flex; justify-content: flex-end; gap: .7rem; }
.circ-actions .btn { min-height: 2.2rem; padding: .3rem 1.1rem; font-size: .75rem; font-weight: 700; border-radius: .5rem; box-shadow: none; }
.badge--pubblicata { background: var(--green-soft); color: var(--green-ink); }
.badge--bozza { background: #e8eae9; color: #5b6764; }
.btn-back { display: inline-flex; align-items: center; justify-content: center; min-width: 9.6rem; height: 2.9rem; border: 3px solid #d7dad9; border-radius: .6rem; background: var(--surface); font-weight: 700; font-size: .95rem; }

.form-card { padding: 2rem 1.7rem 1.5rem; border-radius: 1rem; margin-top: 1.6rem; }
.form-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1.3rem; }
.form-top h2 { font-family: var(--font-form); font-size: 2rem; font-weight: 700; }
.form-top span { color: var(--muted); font-size: .85rem; }
.fld-label { display: block; font-weight: 700; font-size: 1rem; margin: 1.1rem 0 .55rem; }
.fld-hint { font-size: .8rem; color: var(--muted); margin: .45rem 0 .6rem; }
.fld-text, .fld-area { width: 100%; padding: .75rem 1rem; border: 1px solid var(--line-strong); border-radius: .5rem; background: var(--surface); font-size: .85rem; }
.fld-area { min-height: 6.6rem; resize: vertical; }
.fld-text:focus, .fld-area:focus { outline: 2px solid #1a73e8; outline-offset: 0; }
.fld-invalid { border-color: #d92d20 !important; }
.fld-error { color: #d92d20; font-size: .8rem; margin-top: .3rem; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.choice { display: flex; align-items: center; gap: .9rem; padding: .8rem 1rem; border: 1px solid var(--line-strong); border-radius: .6rem; cursor: pointer; }
.choice:has(input:checked) { background: var(--surface-2); border-color: #555; }
.choice input { appearance: none; -webkit-appearance: none; width: 1.1rem; height: 1.1rem; border: 1.5px solid #333; border-radius: 2px; background: var(--surface); display: grid; place-content: center; margin: 0; flex: none; }
html[data-theme="dark"] .choice input { border-color: #ddd; }
.choice input::before { content: ''; width: .5rem; height: .5rem; background: currentColor; transform: scale(0); transition: transform .1s; }
.choice input:checked::before { transform: scale(1); }
.choice strong { display: block; font-size: .8rem; }
.choice small { display: block; font-size: .68rem; color: var(--muted); margin-top: .1rem; }
.form-foot { border-top: 1px solid var(--line); margin-top: 1.5rem; padding-top: 1rem; }
.form-note { display: flex; align-items: center; gap: .6rem; font-size: .8rem; color: var(--muted); }
.form-note .icon { width: 1rem; height: 1rem; }
.form-actions { display: flex; justify-content: flex-end; gap: .8rem; margin-top: 1.1rem; }
.form-actions .btn { min-height: 2.5rem; padding: 0 1.1rem; font-size: .75rem; font-weight: 700; border-radius: .4rem; box-shadow: none; }

/* ---------- 12. Popup ---------- */
.modal-overlay { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 1.5rem; background: rgba(15, 20, 18, .45); opacity: 0; transition: opacity .18s; }
.modal-overlay.is-open { opacity: 1; }
.modal { position: relative; width: min(34.4rem, 94vw); max-height: 92vh; overflow: auto; background: var(--surface); color: var(--ink); border-radius: .9rem; box-shadow: var(--shadow-lg); border: 1px solid var(--line); padding: 2.2rem 2.4rem 2.4rem; transform: translateY(10px) scale(.98); transition: transform .18s; }
.modal-overlay.is-open .modal { transform: none; }
.modal:focus { outline: none; }
.modal--day { min-height: min(45rem, 90vh); padding: 1.8rem 1.9rem; }
.modal--sm { width: min(28rem, 94vw); min-height: 0; }
.modal--wide { width: min(34rem, 94vw); }
.modal--card { width: min(32rem, 94vw); padding: 1.6rem 1.8rem 1.8rem; }
.modal-close { position: absolute; top: .8rem; right: .9rem; width: 2rem; height: 2rem; display: inline-flex; align-items: center; justify-content: center; border-radius: .4rem; color: var(--ink); }
.modal-close:hover { background: rgba(0, 0, 0, .08); }
.modal-close .icon { width: 1.3rem; height: 1.3rem; }
.modal-title { font-size: 1.5rem; font-weight: 700; margin-bottom: .8rem; padding-right: 1.5rem; }
.modal-text { color: var(--ink-2); font-size: 1rem; line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: .8rem; margin-top: 1.6rem; }
.modal-actions .btn { min-height: 2.6rem; }
.info-list { display: grid; gap: .7rem; font-size: 1rem; }
.info-list div { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: .6rem; }
.info-list dt { color: var(--muted); }
.info-list dd { font-weight: 600; }
.opt-list { display: flex; flex-direction: column; gap: .6rem; }
.opt { display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: .6rem; cursor: pointer; font-size: 1rem; }
.opt small { margin-left: auto; color: var(--muted); }
.opt.is-disabled { opacity: .55; cursor: not-allowed; }
.opt input { width: 1.1rem; height: 1.1rem; accent-color: var(--red); }

.form-stack { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.6rem; }
.field { display: flex; flex-direction: column; gap: .35rem; flex: 1; font-size: .9rem; font-weight: 600; }
.field input, .field select, .field textarea { height: 2.7rem; padding: 0 .8rem; border: 1px solid var(--line-strong); border-radius: .5rem; background: var(--surface); font-weight: 400; font-size: 1rem; }
.field-row { display: flex; gap: 1rem; }
.form-error { color: #d92d20; font-size: .9rem; }

/* Popup filtro studenti */
.filter-modal { display: grid; gap: 1.6rem; padding-top: .4rem; }
.f-row { display: grid; grid-template-columns: 1.4rem 5.4rem 1fr 3.4rem; align-items: center; gap: .9rem; }
.f-row > label { font-weight: 700; color: #8a8a8a; font-size: 1rem; }
.f-row.is-on > label { color: var(--ink); }
.f-row input[type="checkbox"] { width: 1.1rem; height: 1.1rem; accent-color: var(--red); }
.f-row select { height: 2.6rem; padding: 0 .9rem; border: 0; border-radius: .5rem; background: var(--chip); color: var(--chip-text); font-weight: 700; font-size: 1rem; }
.f-val { font-weight: 800; font-size: 1.05rem; text-align: right; }
.f-row:not(.is-on) .f-val, .f-row:not(.is-on) input[type="range"], .f-row:not(.is-on) select { opacity: .45; }
input[type="range"].grad { -webkit-appearance: none; appearance: none; height: .5rem; border-radius: 999px; background: linear-gradient(90deg, #ff0000, #c8a000 50%, #2bff00); }
input[type="range"].grad::-webkit-slider-thumb { -webkit-appearance: none; width: 1.2rem; height: 1.2rem; border-radius: 50%; background: #3a3a3a; border: 0; }
input[type="range"].grad::-moz-range-thumb { width: 1.2rem; height: 1.2rem; border-radius: 50%; background: #3a3a3a; border: 0; }
.filter-actions { display: flex; justify-content: center; align-items: center; gap: 1.2rem; margin-top: .4rem; }
.filter-actions .btn { min-width: 6.4rem; min-height: 2.6rem; font-weight: 400; color: #fff; }

.subj-detail { margin-top: 1.4rem; display: flex; flex-direction: column; gap: .8rem; }
.subj-row { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1rem; border-radius: .6rem; background: var(--surface-2); border: 1px solid var(--line); }
.subj-row strong { display: block; font-size: 1rem; }
.subj-row small { color: var(--muted); font-size: .8rem; }
.subj-row b { font-size: 1.4rem; font-weight: 800; color: var(--green-text); }
.subj-row b.is-low { color: #ff0000; }
.subj-sum { display: flex; gap: 2rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); font-size: .95rem; color: var(--muted); }
.subj-sum b { color: var(--ink); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 2rem; z-index: 200; transform: translate(-50%, 1rem); padding: .8rem 1.4rem; border-radius: .6rem; background: #1d1d1b; color: #fff; font-size: .95rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: 90vw; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 13. Login ---------- */
.login-body { min-height: 100vh; background: #cfd3d6 url('../assets/background.png') center / cover no-repeat; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.login-card { width: min(37.5rem, 100%); min-height: 46.3rem; background: #fff; color: #1d1d1b; border-radius: 1.1rem; padding: 2rem 2rem 2.3rem; display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); margin-top: -.3rem; }
.login-logo { width: 100%; height: auto; }
.login-title { font-family: var(--font-login); font-size: 3rem; font-weight: 700; text-align: center; margin-top: 6.5rem; }
.login-sub { font-size: .85rem; text-align: center; color: #3b3b3b; margin-top: .6rem; }
.google-btn { display: flex; align-items: center; justify-content: center; gap: 0; position: relative; width: 100%; height: 3.3rem; margin-top: 5.9rem; border: 1px solid #8a8a8a; border-radius: .35rem; background: #fff; font-size: 1.15rem; color: #1d1d1b; }
.google-btn #google-icon { position: absolute; left: .55rem; width: 1.7rem; height: 1.7rem; }
.google-btn #google-icon svg { width: 100%; height: 100%; }
.google-btn:hover { background: #f6f6f6; }
.login-help { margin-top: auto; font-size: 1.1rem; color: #66726e; }
.login-help a { color: var(--red); font-weight: 700; }
.login-help a:hover { text-decoration: underline; }
.role-list { display: flex; flex-direction: column; gap: .8rem; margin-top: 1.2rem; }
.role-btn { display: flex; align-items: center; gap: 1rem; padding: .9rem 1.1rem; border: 1px solid var(--line); border-radius: .7rem; text-align: left; background: var(--surface); width: 100%; }
.role-btn:hover { border-color: var(--red); background: var(--surface-2); }
.role-btn .avatar { width: 2.8rem; height: 2.8rem; font-size: 1.1rem; }
.role-btn strong { display: block; font-size: 1.05rem; }
.role-btn small { color: var(--muted); }

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