/* ============================================================
   4ZEUS ACADEMY — DESIGN SYSTEM v3
   Inspired by Ian Spalter's UX/UI principles:
   Clarity, rhythm, purposeful color, elegant hierarchy.
   Font: Inter (Google Fonts)
   ============================================================ */

/* Font Inter auto-ospitato per evitare dipendenze esterne */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 300;
    font-display: swap;
    src: url('../fonts/inter/Inter-300.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/inter/Inter-400.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/inter/Inter-500.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/inter/Inter-600.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/inter/Inter-700.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url('../fonts/inter/Inter-800.woff2') format('woff2');
}

/* ── DESIGN TOKENS ─────────────────────────────────────────── */
/* I valori di :root vengono generati dinamicamente da renderDesignTokensStyleTag() */

/* ── RESET ──────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ── BASE ───────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    background-color: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-top: var(--topnav-h);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.page-wrapper {
    display: flex;
    flex-direction: column;
   
}

::selection {
    background: var(--primary-pale);
    color: var(--primary);
}

/* ── TOP NAVIGATION ─────────────────────────────────────────── */
.topnav {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topnav-h);
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: var(--page-gutter);
    padding-right: var(--page-gutter);
    width: 100%;
    z-index: 9999;
    box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 0 0 1px rgba(255,255,255,.04) inset;
    overflow: visible;
}

.topnav-inner {
    width: 100%;
    max-width: none;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.topnavs {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topnav-h);
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 9999;
    box-shadow: 0 1px 3px rgba(0,0,0,.12);
    color: #fff;
}

/* Nav brand */
.nav-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    font-weight: 700;
    font-size: 16px;
    color: #fff;
    flex-shrink: 0;
}

.hilogo {
    height: 60px;
    opacity: .88;
    transition: opacity var(--transition);
    background: var(--logo-brand-bg, transparent);
    border-radius: var(--radius-sm);
    padding: var(--logo-brand-padding, 0);
}

.hilogo--default {
    filter: brightness(0) invert(1);
}

.hilogo:hover { opacity: 1; }

/* User colour bar */
.barra-col {
    width: 3px;
    height: 36px;
    border-radius: 99px;
    flex-shrink: 0;
    margin-right: 4px;
    opacity: .85;
}

/* Dashboard intro (user info in topnav) */
.dashboard-intro {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 10px;
}

.dashboard-intro .user-icon {
    margin: 0;
    flex-shrink: 0;
    height: 32px;
    padding: 2px;
    filter: brightness(0) invert(1);
    opacity: .8;
}

.dashboard-intro-meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.dashboard-intro-text {
    display: inline-flex;
    flex-direction: column;
    gap: 1px;
}

/* Docenti disponibili pill (header CTA) */
.availability-alert {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 14px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.35);
    color: #fff;
    text-decoration: none;
    font-size: 12px;
    line-height: 1.2;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.availability-alert__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    font-size: 13px;
}

.availability-alert__label {
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: 11px;
    opacity: .85;
}

.availability-alert__hours {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.75);
}

.availability-alert:hover {
    background: rgba(15, 23, 42, 0.55);
    border-color: rgba(255, 255, 255, 0.4);
}

.dashboard-ruolo {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .8px;
    text-transform: uppercase;
    color: rgba(255,255,255,.5);
    line-height: 1.2;
}

.dashboard-nome {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,.92);
    line-height: 1.2;
}

/* Nav links */
.nav-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1px;
}

.nav-links a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    color: var(--nav-links-color, #ffffff);
    opacity: var(--nav-links-opacity, 0.72);
    text-decoration: none;
    font-size: 12.5px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
    position: relative;
    letter-spacing: .1px;
}

 .nav-links a:hover {
    background: rgba(255,255,255,.1);
    color: var(--nav-links-hover-color, #ffffff);
    opacity: 1;
}

.nav-links a:active {
    background: rgba(255,255,255,.15);
    opacity: 1;
}

.nav-links .icon {
    height: 24px;
    display: inline-block;
    vertical-align: middle;
    filter: brightness(0) invert(1);
    opacity: .75;
}

/* Badge notifications */
.nav-links .has-badge { position: relative; padding-right: 2rem; }

.nav-links .nav-badge {
    position: absolute;
    top: 2px; right: 2px;
    background: #ef4444;
    color: #fff;
    border-radius: 999px;
    padding: .1rem .4rem;
    font-size: 10px;
    font-weight: 700;
    border: 2px solid var(--primary);
    min-width: 18px;
    text-align: center;
    line-height: 1.4;
}

.nav-links .nav-badge,
.nav-links .nav-badge-alert { opacity: 1; }

.nav-links .nav-badge-alert { animation: navBadgePulse 2s infinite; }

@keyframes navBadgePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .6; transform: scale(.92); }
}

/* Mobile hamburger */
.nav-toggle {
    display: none;
    font-size: 100px;
    color: rgba(255,255,255,.9);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    line-height: 1;
    background: none;
    border: none;
    transition: background var(--transition);
}

.nav-toggle:hover { background: rgba(255,255,255,.1); }

/* User icon */
.user-icon {
    height: 32px;
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    filter: brightness(0) invert(1);
    opacity: .75;
    margin-left: 10px;
}

/* Admin icon in menu */
.admin-menu-icon {
    display: block;
    height: 26px;
    width: auto;
    margin: 0 auto;
}

/* ── LAYOUT STRUCTURE ───────────────────────────────────────── */
.sidebar {
    width: 220px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 28px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: var(--shadow-xs);
}

.sidebar h2 {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 16px;
    padding: 0 8px;
}

.sidebar a {
    text-decoration: none;
    color: var(--text-soft);
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar a:hover {
    background: var(--primary-pale);
    color: var(--primary);
}

.main {
    flex: 1;
    padding: 24px var(--page-gutter);
    width: min(100%, var(--page-max));
    max-width: var(--page-max);
    margin-left: auto;
    margin-right: auto;
}

/* ── TYPOGRAPHY ─────────────────────────────────────────────── */
h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
    letter-spacing: -.4px;
    line-height: 1.3;
}

h2 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
    letter-spacing: -.2px;
    line-height: 1.3;
}

h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    line-height: 1.4;
}

h4 {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
    line-height: 1.4;
}

.titolo {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
    letter-spacing: -.3px;
}

.link-alt {
    color: var(--primary-mid);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition);
    margin-left: 4px;
}

.link-alt:hover { color: var(--primary); text-decoration: underline; }

a.lin {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition);
}

a.lin:hover { color: var(--primary-light); }

/* ── BOXES / CARDS ──────────────────────────────────────────── */
.box {
    background: var(--surface);
    padding: 22px 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 20px;
    transition: box-shadow var(--transition);
}

.boxlogin {
    max-width: 440px;
    margin: 60px auto 24px;
    background: var(--surface);
    padding: 40px 36px;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.boxlogin::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
}

.corsiesistenti {
    margin-top: 28px;
    background: var(--surface);
    padding: 22px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.corso-blocco {
    margin-bottom: 8px;
    padding: 14px 16px;
    background: var(--surface-3);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: border-color var(--transition);
}

.corso-blocco:hover { border-color: var(--border-strong); }

/* ── STAT CARDS ─────────────────────────────────────────────── */
.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 20px 0;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin: 20px 0;
}

.card {
    background: var(--surface);
    padding: 18px 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    text-align: center;
    border-top: 3px solid var(--primary-light);
    transition: transform var(--transition), box-shadow var(--transition);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card h3 {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .8px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.card p {
    font-size: 26px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -1px;
}

/* ── TABLES ─────────────────────────────────────────────────── */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 13.5px;
}

th, td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--surface-2);
    color: var(--text-soft);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
    white-space: nowrap;
}

tr:hover td { background: var(--surface-2); }

.tabella-enti {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 13.5px;
}

.tabella-enti th, .tabella-enti td {
    border: 1px solid var(--border);
    padding: 10px 14px;
    text-align: left;
}

.tabella-enti th {
    background: var(--surface-2);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: var(--text-soft);
}

.tabella-enti tr:nth-child(even) td { background: var(--surface-2); }
.tabella-enti tr:hover td { background: var(--primary-pale); }

/* ── BUTTONS ─────────────────────────────────────────────────── */
button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--primary);
    color: #fff;
    padding: 9px 18px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    letter-spacing: .1px;
    transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
    white-space: nowrap;
    line-height: 1.4;
}

button:hover, .btn:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

button:active, .btn:active {
    transform: translateY(0);
    box-shadow: none;
}

button:focus-visible, .btn:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}

/* Button size variants */
.btnl {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary);
    color: #fff;
    padding: 7px 14px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    transition: background var(--transition), box-shadow var(--transition);
    margin-top: 4px;
}

.btnl:hover { background: var(--primary-hover); box-shadow: var(--shadow-sm); }

.bll {
    position: fixed;
    bottom: 180px;
    left: 12px;
    background: var(--primary);
    color: #fff;
    padding: 8px 14px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: background var(--transition), box-shadow var(--transition);
    box-shadow: var(--shadow-md);
    z-index: 100;
}

.bll:hover { background: var(--primary-hover); box-shadow: var(--shadow-lg); }

/* Semantic button colours */
.btn-elimina {
    background: var(--danger);
    color: #fff;
    border: none;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    transition: background var(--transition);
}
.btn-elimina:hover { background: #b91c1c; }

.btn-duplica {
    background: var(--success);
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 600;
    font-family: inherit;
    margin-left: 4px;
    transition: background var(--transition);
}
.btn-duplica:hover { background: #047857; }

.btnDettagli {
    background: var(--primary-mid);
    color: #fff;
    border: none;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    transition: background var(--transition);
}
.btnDettagli:hover { background: var(--primary); }

.modoc {
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    font-size: 12.5px;
    transition: background var(--transition);
}
.modoc:hover { background: #1d4ed8; }

.toggle-dettagli {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    transition: background var(--transition);
    margin-right: 6px;
}
.toggle-dettagli:hover { background: var(--primary-hover); }

/* Mail request button */
.btn-mail-richiesta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--danger-border);
    background: var(--danger-bg);
    color: var(--danger);
    font-weight: 600;
    font-size: 12.5px;
    text-decoration: none;
    margin-right: 6px;
    transition: background var(--transition), box-shadow var(--transition);
}
.btn-mail-richiesta:hover {
    background: #fee2e2;
    box-shadow: var(--shadow-sm);
}
.btn-mail-richiesta.disabled,
.btn-mail-richiesta:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* ── FORMS ───────────────────────────────────────────────────── */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    margin-top: 5px;
    margin-bottom: 14px;
    font-family: inherit;
    font-size: 13.5px;
    color: var(--text);
    background: var(--surface);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(75,124,245,.12);
}

textarea { resize: vertical; min-height: 90px; line-height: 1.6; }

input[type="color"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: 2px solid var(--border);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    padding: 2px;
    margin: 0;
    background: none;
    cursor: pointer;
    transition: border-color var(--transition);
}
input[type="color"]:hover { border-color: var(--primary-light); }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; border: none; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 50%; }
input[type="color"]::-moz-color-swatch { border: none; border-radius: 50%; }

label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-soft);
    margin-bottom: 3px;
    letter-spacing: .2px;
}

/* ── ALERTS ──────────────────────────────────────────────────── */
.alert-success {
    background: var(--success-bg);
    color: #065f46;
    padding: 12px 16px;
    margin-bottom: 16px;
    border-left: 3px solid var(--success);
    border-radius: var(--radius);
    font-size: 13.5px;
    font-weight: 500;
}

.alert-error {
    background: var(--danger-bg);
    color: #991b1b;
    padding: 12px 16px;
    margin-bottom: 16px;
    border-left: 3px solid var(--danger);
    border-radius: var(--radius);
    font-size: 13.5px;
    font-weight: 500;
}

/* ── ADMIN MENU ──────────────────────────────────────────────── */
.admin-menu {
    margin: 20px auto;
    padding: 24px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.admin-menu h2 {
    text-align: left;
    margin-bottom: 18px;
    color: var(--text);
    font-size: 15px;
    font-weight: 700;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
    letter-spacing: -.1px;
}

.admin-menu ul { list-style: none; padding: 0; }

.admin-menu li { margin: 6px 0; }

.admin-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none;
    padding: 0;
    margin-top: 10px;
}

.admin-links li { flex: 0 0 auto; }

.admin-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 13px;
    background: var(--primary);
    color: #fff;
    text-align: center;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    font-size: 11.5px;
    width: 64px;
    transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
}

.admin-links a:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

/* Admin groups */
.admin-groups-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.admin-menu-group {
    flex: 1 1 180px;
    margin-top: 0;
}

.admin-group-toggle {
    width: 100%;
    border: none;
    border-radius: var(--radius);
    padding: 10px 14px;
    font-weight: 700;
    font-size: 11.5px;
    font-family: inherit;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
    letter-spacing: .3px;
}

.admin-group-toggle:hover {
    opacity: .92;
    box-shadow: var(--shadow-sm);
}
.admin-group-toggle:active { transform: scale(.98); }

.admin-group-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.admin-group-badge {
    background: #fff;
    color: #dc2626;
    border-radius: 999px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    font-size: 10px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
    animation: badgePulse 2s infinite;
    transform-origin: center;
}

.admin-group-badge--blue {
    color: #2563eb;
    animation: badgePulse 2.2s infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); }
}

.admin-group-arrow {
    transition: transform var(--transition);
    font-size: 10px;
    opacity: .6;
}

.admin-group-toggle.open .admin-group-arrow { transform: rotate(180deg); }

.admin-submenu { display: none; }

.admin-expanded {
    display: none;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
    padding: 12px;
    background: var(--surface-2);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.admin-expanded.active { display: flex; }
.admin-expanded li { flex: 0 0 auto; }

/* Admin background colour helpers */
.bg-admin         { background: var(--primary) !important; }
.bg-superadmin    { background: #065f46 !important; }
.bg-ente-light    { background: #34d399 !important; color: #064e3b !important; }
.bg-yoda          { background: #7f1d1d !important; }
.bg-docenti-corsi { background: #991b1b !important; color: #fff !important; }
.bg-ricavi        { background: #fecdd3 !important; color: #881337 !important; }
.bg-skywalker     { background: #b45309 !important; }
.bg-fuxia         { background: #9333ea !important; color: #fff !important; }
.bg-orange        { background: #c2410c !important; color: #fff !important; }
.bg-agent         { background: #312e81 !important; color: #fff !important; }

/* ── COURSE BOXES ────────────────────────────────────────────── */
.contenitore-corsi {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: flex-start;
    margin-top: 16px;
}

.box-corso {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary-light);
    padding: 16px 18px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    position: relative;
}

.box-corso:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-left-color: var(--primary-mid);
}

.box-corso h2 {
    font-size: 14.5px;
    margin-top: 0;
    color: var(--primary);
    font-weight: 700;
}

.box-corso p {
    margin: 4px 0;
    font-size: 13px;
    color: var(--text-soft);
}

/* Disabled / finished courses */
.corso-disattivo { opacity: .5; background: var(--surface-3) !important; }
.corso-finito { background: var(--success-bg) !important; color: #065f46 !important; font-style: italic; }

/* ── COURSE CARDS GRID ───────────────────────────────────────── */
.griglia-corsi { display: grid; gap: 16px; }
.colonne-2  { grid-template-columns: repeat(2, 1fr); }
.colonne-3  { grid-template-columns: repeat(3, 1fr); }
.colonne-4  { grid-template-columns: repeat(4, 1fr); }
.colonne-5  { grid-template-columns: repeat(5, 1fr); }
.colonne-6  { grid-template-columns: repeat(6, 1fr); }
.colonne-7  { grid-template-columns: repeat(7, 1fr); }
.colonne-8  { grid-template-columns: repeat(8, 1fr); }
.colonne-9  { grid-template-columns: repeat(9, 1fr); }
.colonne-10 { grid-template-columns: repeat(10, 1fr); }

.card-corso {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: hidden;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
    text-align: center;
}

.card-corso:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.card-corso img {
    width: 100%;
    height: 175px;
    object-fit: cover;
    display: block;
}

.titolo-corso {
    padding: 10px 12px;
    font-weight: 700;
    font-size: 13.5px;
    color: var(--text);
}

/* ── DOCENTE BOX ─────────────────────────────────────────────── */
.box-docente {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--surface);
    border-radius: var(--radius);
    margin-bottom: 8px;
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border);
    gap: 12px;
    transition: border-color var(--transition);
}

.box-docente:hover { border-color: var(--border-strong); }

.info-docente {
    flex-grow: 1;
    font-size: 13.5px;
}

.azioni-docente {
    display: flex;
    gap: 6px;
    align-items: center;
}

.azioni-docente form,
.azioni-docente button { margin: 0; }

.ruolo {
    font-size: 11px;
    font-weight: 500;
    margin-left: 5px;
    color: var(--text-muted);
}

/* ── ASSIGNMENT ROWS ─────────────────────────────────────────── */
.riga-assegnazione {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
    width: 100%;
    flex-wrap: wrap;
}

.riga-assegnazione form { display: flex; align-items: center; gap: 10px; }
.riga-assegnazione select { min-width: 200px; }

.info-studente {
    min-width: 150px;
    font-weight: 600;
    white-space: nowrap;
    font-size: 13.5px;
}

.riga-assegnazione-studente {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.info-studente-assegnazione {
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 160px;
    font-size: 13.5px;
}

.form-modifica-assegnazione {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.form-modifica-assegnazione select { min-width: 200px; }

.form-elimina-assegnazione { display: flex; align-items: center; }

/* ── FORM ACTIONS ────────────────────────────────────────────── */
.corso-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 6px;
    margin-bottom: 12px;
}

.corso-actions input[type="date"],
.corso-actions input[type="color"],
.corso-actions button { height: 38px; }

.form-elimina { display: inline-block; margin-left: 8px; }

.form-modifica input[type="text"],
.form-modifica select,
.form-modifica input[type="date"],
.form-modifica input[type="color"],
.form-modifica button {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 10px;
}

/* ── COURSE ACTIONS ROW ──────────────────────────────────────── */
.azioni-corso { display: inline-flex; gap: 6px; align-items: center; }

/* ── INFO PILLS ──────────────────────────────────────────────── */
.info-luogo {
    margin-left: 6px;
    font-size: 11.5px;
    color: var(--primary);
    background: var(--primary-pale);
    padding: 3px 10px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}

.info-luogo.mancante {
    background: var(--danger-bg);
    color: var(--danger);
    font-style: italic;
}

/* ── COLOUR BAR (corso colour strip) ────────────────────────── */
.barra-colore {
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    border-top-left-radius: var(--radius-lg);
    border-bottom-left-radius: var(--radius-lg);
}

/* ── OVERLAYS / MODALS ───────────────────────────────────────── */
.form-overlay {
    position: absolute;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 28px 30px;
    width: 90%;
    max-width: 900px;
    box-shadow: var(--shadow-xl);
}

.overlay-background {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
}

.chiudi-form {
    position: absolute;
    top: 12px; right: 14px;
    background: transparent;
    border: none;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    z-index: 1001;
    line-height: 1;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
}
.chiudi-form:hover { color: var(--danger); background: var(--danger-bg); }

/* ── MENU FUNZIONALITA ───────────────────────────────────────── */
.menu-funzionalita {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.menu-funzionalita .btn {
    background: var(--primary);
    color: #fff;
    padding: 9px 16px;
    text-decoration: none;
    font-weight: 600;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
    font-size: 13px;
}

.menu-funzionalita .btn:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

/* ── PLATFORM BLOCK ──────────────────────────────────────────── */
.blocco-piattaforma { margin: 36px 20px; }

/* ── TIME FIELDS ─────────────────────────────────────────────── */
.riga-orari {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 14px;
}

.riga-orari .campo { display: flex; flex-direction: column; }
.riga-orari .campo input { font-size: 16px; }

/* ── LAYOUT UTILS ────────────────────────────────────────────── */
.divide { margin-top: 36px; margin-bottom: 36px; }

.right {
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    gap: 8px;
}

.destra { float: right; }

.hidden { display: none; }

/* ── DETTAGLI ENTE ───────────────────────────────────────────── */
.dettagli-ente {
    margin-top: 10px;
    padding: 14px 16px;
    background: var(--surface-2);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.dettagli-ente input,
.dettagli-ente textarea,
.dettagli-ente label { display: block; margin: 3px 0; }

.dettagli-ente label { font-weight: 600; font-size: 11.5px; color: var(--text-soft); }

/* ── IMAGES ──────────────────────────────────────────────────── */
.corso-immagini-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.copertina-container,
.galleria-container { flex: 1; min-width: 250px; }

.img-copertina {
    max-width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.galleria-immagini { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 5px; }

.img-galleria { max-width: 120px; border-radius: var(--radius-sm); box-shadow: var(--shadow-xs); }

.file-inputs-wrapper {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 10px;
    margin-bottom: 10px;
}

.file-block { flex: 1; min-width: 250px; }

/* ── COLOUR TEXT HELPERS ─────────────────────────────────────── */
.colente { color: var(--success); font-weight: 600; }
.red { text-decoration: none; color: var(--danger) !important; font-weight: 700; }
.ru  { font-size: 28px; }
.file { font-size: 52px; }

/* ── DOC ITEMS ───────────────────────────────────────────────── */
.doc-links {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 8px;
}

.doc-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto; height: auto;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    padding: 0;
}

.doc-item .file { font-size: 32px; line-height: 1; }

.doc-item .link,
.doc-item em,
.doc-item small { display: none !important; }
.doc-item .link { display: inline-flex !important; pointer-events: auto; }

.form-elimina .btn-danger {
    padding: 4px 9px;
    font-size: 11.5px;
    border-radius: var(--radius-sm);
    background: #991b1b;
    color: #fff;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: background var(--transition);
}
.form-elimina .btn-danger:hover { background: #b91c1c; }

/* ── COURSE ICON / SHAPE ─────────────────────────────────────── */
.course-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6em; height: 1.6em;
    font-weight: 600;
    font-size: .95em;
    color: var(--course-icon-color, currentColor);
    border-radius: .5em;
    line-height: 1;
}

.course-icon--picker { width: 2.4em; height: 2.4em; font-size: 1.4em; }

.course-title-with-icon { display: inline-flex; align-items: center; gap: 6px; }

.course-icon--pill {
    background: #fff;
    border: 1px solid rgba(0,0,0,.1);
}

.course-icon--calendar {
    width: 30px; height: 30px;
    font-size: 1.5rem;
    border-radius: 15px;
    background: #fff;
}

.course-shape-option {
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    background: var(--surface);
    transition: border-color var(--transition), box-shadow var(--transition);
    font-size: 13px;
    font-weight: 600;
}

.course-shape-option.selected {
    border-color: var(--primary-mid);
    box-shadow: 0 0 0 3px rgba(43,82,197,.1);
}

.course-shape-option input { display: none; }
.course-shape-label { font-weight: 600; }

.course-shape-options { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── DIVDOC ──────────────────────────────────────────────────── */
.divdoc {
    padding-left: 360px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

/* ── FOOTER ──────────────────────────────────────────────────── */
.footer {
    background: #111827;
    color: rgba(255,255,255,.6);
    padding: 32px var(--page-gutter);
    font-size: 13px;
    margin-top: auto;
}

.footer a { color: #fbbf24; text-decoration: none; transition: color var(--transition); }
.footer a:hover { color: #fde68a; text-decoration: underline; }

.footer-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 24px;
    width: 100%;
}

.footer-col { flex: 1; min-width: 200px; }

.footer-col h4 {
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: .2px;
}

.footer-col ul {
    list-style: none;
    padding: 0;
}

.footer-col ul li {
    margin-bottom: 6px;
}

.footer-col p {
    margin-bottom: 6px;
    font-size: 12.5px;
    line-height: 1.5;
}

.footer-bottom {
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,.08);
    margin-top: 24px;
    font-size: 11.5px;
    color: rgba(255,255,255,.35);
}

.footer .hilogo {
    height: 32px;
    opacity: .5;
}

/* ── MISC ────────────────────────────────────────────────────── */
.form-richiesta-indirizzo { display: inline; margin-right: 6px; }

/* ── LOGIN PAGE EXTRAS ───────────────────────────────────────── */
label[for="togglePassword"] {
    font-size: 12.5px;
    color: var(--text-soft);
    margin-left: 6px;
    display: inline;
    font-weight: 400;
}

.consent-block {
    margin: 14px 0;
    font-size: 13px;
    color: var(--text-soft);
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 12px 14px;
    background: var(--surface-2);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.consent-block label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-weight: 400;
    color: var(--text-soft);
    cursor: pointer;
    font-size: 13px;
}

.consent-block input[type="checkbox"] {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 2px;
    accent-color: var(--primary);
    cursor: pointer;
}

.consent-block a {
    color: var(--primary-mid);
    font-weight: 600;
    text-decoration: none;
}

.consent-block a:hover { text-decoration: underline; }

body.js-consent-ready .consent-block.hidden { display: none; }

/* ── TELEGRAM LOGIN HINT ─────────────────────────────────────── */
.telegram-login {
    border: 1.5px solid #bfdbfe;
    border-radius: var(--radius-lg);
    background: var(--info-bg);
    padding: 16px 18px;
    margin: 16px 0;
}

.telegram-login.hidden { display: none; }

.telegram-login strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #0c4a6e;
    margin-bottom: 6px;
}

.telegram-login p {
    font-size: 12.5px;
    color: #0369a1;
    margin-bottom: 6px;
}

.telegram-login code {
    display: block;
    padding: 9px 12px;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius);
    margin: 6px 0;
    font-family: 'Courier New', monospace;
    font-size: 12.5px;
    letter-spacing: .3px;
}

.telegram-login textarea {
    width: 100%;
    min-height: 68px;
    border: 1.5px solid #bfdbfe;
    border-radius: var(--radius);
    padding: 8px 10px;
    font-family: 'Courier New', monospace;
    background: #fff;
    font-size: 12px;
    resize: vertical;
    color: var(--text);
}

.telegram-login-actions { margin-top: 8px; }

.telegram-login-actions a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--primary-mid);
    color: #fff;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 700;
    font-size: 12.5px;
    transition: background var(--transition);
}

.telegram-login-actions a:hover { background: var(--primary); }

/* ── STUDENT DASHBOARD ───────────────────────────────────────── */
.student-doc-alert {
    background: var(--surface);
    border: 1px solid var(--warning-border);
    border-left: 3px solid var(--warning);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 20px;
}

.student-doc-alert h3 {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--warning);
    margin-bottom: 10px;
}

.student-doc-alert ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.student-doc-alert li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    padding: 7px 10px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
}

.student-doc-alert li a {
    color: var(--primary-mid);
    font-weight: 600;
    text-decoration: none;
    flex: 1;
}

.student-doc-alert li a:hover { text-decoration: underline; }

.student-doc-alert li small {
    color: var(--text-muted);
    font-size: 11px;
    white-space: nowrap;
}

.doc-type {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    background: var(--primary-pale);
    color: var(--primary);
    border-radius: var(--radius-xs);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .4px;
    white-space: nowrap;
}

.student-doc-alert__link {
    display: inline-flex;
    align-items: center;
    margin-top: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-mid);
    text-decoration: none;
}

.student-doc-alert__link:hover { text-decoration: underline; }

/* ── SECTION DIVIDER ─────────────────────────────────────────── */
.section-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .8px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 24px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

/* ── PAGE HEADER AREA ────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.page-header h1 { margin-bottom: 4px; }

.page-header p {
    color: var(--text-soft);
    font-size: 13px;
    margin: 0;
}

.page-header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* ── BADGE / PILL utilities ──────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .3px;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger);  }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info    { background: var(--info-bg);    color: var(--info);    }
.badge-primary { background: var(--primary-pale); color: var(--primary); }

/* ── EMPTY STATE ─────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state p { font-size: 14px; margin-top: 8px; }

/* ── FORNITORE (Facility Provider) INTERFACE ─────────────────── */
.fornitore-header {
    background: #111827;
    color: #fff;
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.fornitore-header h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -.2px;
}

.fornitore-header small {
    color: var(--text-muted);
    font-size: 12px;
    display: block;
    margin-top: 1px;
}

.fornitore-nav {
    background: #1e293b;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 20px;
}

.fornitore-nav a {
    color: #9ca3af;
    text-decoration: none;
    padding: 7px 14px;
    border-radius: var(--radius);
    font-size: 12.5px;
    font-weight: 600;
    transition: background var(--transition), color var(--transition);
}

.fornitore-nav a.active,
.fornitore-nav a:hover {
    background: #f97316;
    color: #111827;
}

.fornitore-content {
    padding: 24px 26px;
    min-height: calc(100vh - 160px);
    background: var(--bg);
}

.fornitore-panel {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.fornitore-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.fornitore-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 700;
}

.fornitore-badge.success { background: #dcfce7; color: #15803d; }
.fornitore-badge.info    { background: #dbeafe; color: #1d4ed8; }

.fornitore-select {
    min-width: 200px;
    padding: 7px 10px;
    border-radius: var(--radius);
    border: 1.5px solid var(--border-strong);
    font-size: 13px;
    font-family: inherit;
}

/* ── ENTE (Organization) INTERFACE ──────────────────────────── */
.ente-header {
    background: #111827;
    color: #fff;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: 0 1px 0 rgba(255,255,255,.05);
}

.ente-header__left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.ente-header__logo {
    width: 46px; height: 46px;
    border-radius: var(--radius);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    flex-shrink: 0;
}

.ente-header__logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.ente-header h1 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -.2px;
}

.ente-header small {
    display: block;
    font-size: 12px;
    color: #9ca3af;
    margin-top: 1px;
}

/* Ente top navigation */
.ente-topnav {
    background: #1e293b;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 20px;
    position: sticky;
    top: 0;
    z-index: 40;
    box-shadow: 0 1px 0 rgba(255,255,255,.04);
}

.ente-topnav a {
    color: #9ca3af;
    text-decoration: none;
    padding: 7px 14px;
    border-radius: var(--radius);
    font-size: 12.5px;
    font-weight: 600;
    transition: background var(--transition), color var(--transition);
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ente-topnav a.active,
.ente-topnav a:hover {
    background: #38bdf8;
    color: #0f172a;
}

/* Ente nav badge */
.ente-nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}

.ente-nav-badge--pending {
    background: #dc2626;
    color: #fff;
    animation: navBadgePulse 1.5s infinite;
}

.ente-nav-badge--success { background: #22c55e; color: #0f172a; }

/* Ente main content area */
.ente-content {
    padding: 24px 26px;
    min-height: calc(100vh - 120px);
    background: var(--bg);
}

/* Ente tag / status pill */
.ente-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
}

.ente-tag.success { background: #dcfce7; color: #15803d; }
.ente-tag.warning { background: #fef3c7; color: #b45309; }
.ente-tag.info    { background: #dbeafe; color: #1d4ed8; }
.ente-tag.danger  { background: #fee2e2; color: #b91c1c; }

/* Ente card */
.ente-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

/* Ente grid */
.ente-grid { display: grid; gap: 16px; }
.ente-grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.ente-grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* Stat card */
.stat-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
}

.stat-card__head h3 {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .7px;
    color: var(--text-muted);
    margin: 0;
}

.stat-card__value {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1;
}

/* Ente table */
.ente-table {
    width: 100%;
    border-collapse: collapse;
}

.ente-table th,
.ente-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-size: 13.5px;
}

.ente-table th {
    background: var(--surface-2);
    color: var(--text);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
}

.ente-table tbody tr:hover td { background: var(--surface-2); }

/* Ente switcher form */
.ente-switch-form {
    margin: 12px 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ente-switch-form label {
    font-weight: 700;
    color: var(--text);
    font-size: 13px;
    margin-bottom: 0;
}

.ente-switch-form select {
    padding: 7px 11px;
    border-radius: var(--radius);
    border: 1.5px solid var(--border-strong);
    font-size: 13px;
    background: #fff;
    width: auto;
    margin: 0;
}

/* Ente button variants */
.ente-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius);
    font-size: 12.5px;
    font-weight: 700;
    font-family: inherit;
    text-decoration: none;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: filter var(--transition), box-shadow var(--transition);
}

.ente-btn.primary   { background: #2563eb; color: #fff; }
.ente-btn.secondary { background: #fff; color: #1e293b; border-color: var(--border-strong); }
.ente-btn.danger    { background: #dc2626; color: #fff; }
/* Doppia classe: serve a battere .ente-btn.primary/.secondary sulla specificita'. */
.ente-btn.ente-btn--azzurro { background: #0ea5e9; color: #fff; border-color: #0ea5e9; }
.ente-btn.ente-btn--ambra   { background: #ffbf00; color: #1f2937; border-color: #ffbf00; }
.ente-btn:hover     { filter: brightness(.93); box-shadow: var(--shadow-sm); }

/* ── DASHBOARD COMPONENTS ───────────────────────────────────── */

/* Dashboard overview */
.dashboard-overview { margin: 20px 0 18px; }

.dashboard-overview__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.dashboard-overview__head h2 { margin: 0; font-size: 18px; }

.dashboard-overview__intro {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 13px;
}

/* KPI grid */
.dashboard-kpi-grid {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
    align-items: stretch;
}

/* Teacher instruction manual banner */
.guide-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding: 16px 18px;
    border-radius: 16px;
    border: 1px solid rgba(14, 165, 233, .28);
    background: linear-gradient(180deg, #f0f9ff 0%, #ffffff 100%);
    box-shadow: 0 10px 24px rgba(15, 23, 42, .05);
}
.guide-banner__copy h2 {
    margin: 0 0 6px;
    font-size: 1.05rem;
    color: #0f172a;
}
.guide-banner__copy p {
    margin: 0;
    color: #475569;
    font-size: 13px;
    line-height: 1.5;
    max-width: 72ch;
}
.guide-banner__button {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-weight: 700;
    font-size: 13px;
    color: #fff;
    background: linear-gradient(135deg, #0369a1, #0ea5e9);
    border-radius: 12px;
    padding: 10px 16px;
    white-space: nowrap;
}
.guide-banner__button:hover {
    box-shadow: 0 8px 18px rgba(3, 105, 161, .28);
}

/* Service card grid */
.dashboard-service-grid {
    display: grid;
    grid-template-columns: 1.35fr 1fr 1fr 1fr;
    gap: 12px;
    align-items: stretch;
}

.dashboard-service-grid--three {
    grid-template-columns: 1fr 1fr 1fr;
}

/* Metric cards */
.card--metric {
    text-align: left;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
    padding: 14px 12px;
    border-top-width: 2px;
}

.card--metric h3 {
    margin: 0 0 8px;
    font-size: 10px;
    line-height: 1.2;
    color: var(--text-muted);
    letter-spacing: .04em;
}

.card--metric p { margin: 0; }

.card--metric strong {
    font-size: 1.4rem;
    line-height: 1.05;
    color: var(--text);
    word-break: break-word;
    font-weight: 800;
}

.dashboard-metric-filter {
    margin: 0 0 8px;
}

.dashboard-metric-filter label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 700;
}

.dashboard-metric-filter select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 5px 7px;
    font: inherit;
    color: var(--text);
    background: #fff;
}

.dashboard-overview-filter {
    margin: 0;
}

.dashboard-overview-filter label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 800;
}

.dashboard-overview-filter select {
    min-width: 170px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
    color: var(--text);
    background: #fff;
}

.card--placeholder strong { color: var(--text-muted); }

.card__empty {
    margin: 0;
    color: var(--text-muted);
    font-size: 12.5px;
    line-height: 1.35;
}

/* Service cards */
.dashboard-service-card {
    min-height: 150px;
    text-align: left;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
    border-top-width: 2px;
}

.dashboard-service-card h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.1px;
}

.dashboard-service-card--amm {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

/* AMM grid */
.amm-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.amm-item {
    border: 1px solid #dbeafe;
    border-radius: var(--radius);
    padding: 10px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.amm-item--muted {
    background: var(--surface-2);
    border-color: var(--border);
}

.amm-item--muted strong,
.amm-item--muted .amm-item__perc { color: var(--text-muted); }

.amm-item__label {
    font-size: 10px;
    color: var(--text-soft);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.amm-item__perc {
    font-size: 12px;
    color: var(--primary-mid);
    font-weight: 700;
}

.amm-item strong {
    font-size: 1.1rem;
    color: var(--text);
    line-height: 1.1;
    word-break: break-word;
}

.amm-nota-incarico {
    margin: 10px 0 0;
    font-size: 11px;
    line-height: 1.45;
    color: var(--text-soft);
}

/* Service card text and buttons */
.service-card__text {
    margin: 0;
    color: var(--text-muted);
    font-size: 12.5px;
    line-height: 1.45;
}

.service-card__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-strong);
    color: var(--primary);
    background: var(--surface);
    border-radius: var(--radius);
    padding: 9px 14px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 700;
    font-size: 12.5px;
    width: fit-content;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.service-card__button:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.service-card__button--whatsapp {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
}
.service-card__button--whatsapp:hover {
    background: #15803d;
    border-color: #15803d;
}

/* Dashboard flash */
.alert-dashboard {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-weight: 600;
    font-size: 13px;
}
.alert-dashboard.success {
    background: #ecfccb;
    color: #365314;
    border: 1px solid #bef264;
}
.alert-dashboard.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Accettazione cards */
.accettazione-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 10px;
    background: var(--surface-2);
    transition: border-color var(--transition);
}

.accettazione-card:hover { border-color: var(--border-strong); }

.acc-header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

.acc-header small {
    display: block;
    color: var(--text-muted);
    font-size: 12.5px;
    margin-top: 2px;
}

.acc-tag {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.tag-success { background: #dcfce7; color: #166534; }
.tag-warning { background: #fef3c7; color: #92400e; }
.tag-info    { background: #dbeafe; color: var(--primary); }

.acc-form textarea { width: 100%; min-height: 60px; margin: 10px 0; }

.acc-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.acc-form .btn {
    padding: 8px 14px;
    border-radius: var(--radius);
    border: none;
    background: var(--primary-mid);
    color: #fff;
    cursor: pointer;
    font-size: 12.5px;
}
.acc-form .btn.danger { background: var(--danger); }

.acc-form .btn.ghost,
.btn.ghost {
    background: var(--surface);
    color: var(--primary);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 8px 14px;
    cursor: pointer;
    font-size: 12.5px;
    transition: border-color var(--transition), background var(--transition);
}
.btn.ghost:hover {
    border-color: var(--primary-light);
    background: var(--primary-pale);
}

.acc-note {
    margin: 8px 0 0;
    font-size: 12.5px;
    color: var(--text-soft);
}

.acc-header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.acc-header-main .header-link { white-space: nowrap; }
.acc-link { display: inline-flex; margin-top: 6px; }

/* Admin accettazioni list */
.acc-admin-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.acc-admin-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--surface-2);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    flex-wrap: wrap;
    font-size: 13px;
}

.acc-admin-list li strong {
    flex: 1;
    min-width: 120px;
}

.acc-admin-list li small {
    color: var(--text-muted);
    font-size: 11.5px;
}

/* Rating components */
.dashboard-service-card--rating { justify-content: flex-start; }
.dashboard-service-card--rating .rating-summary { gap: 4px; height: 100%; justify-content: flex-start; }

.rating-summary {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    margin: 0;
    flex-direction: column;
}

.rating-summary--button {
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    padding: 0;
    cursor: pointer;
    min-height: 100%;
}

.rating-summary--button:focus-visible {
    outline: 2px solid var(--primary-mid);
    border-radius: var(--radius);
}

.rating-summary__hearts { display: flex; gap: 3px; flex-wrap: wrap; }

.rating-heart {
    font-size: 18px;
    color: var(--border);
    line-height: 1;
    transition: color var(--transition);
}
.rating-heart.is-active { color: #e11d48; }

.rating-summary__score {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
    margin-top: 4px;
}

.rating-summary__details {
    font-size: 12px;
    color: var(--text-soft);
    line-height: 1.3;
}

.rating-summary__hint {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-top: 2px;
    line-height: 1.3;
}

/* Lezioni oggi */
.lezioni-oggi-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lezione-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    flex-wrap: wrap;
    transition: border-color var(--transition);
}

.lezione-item:hover { border-color: var(--border-strong); }

.lezione-item__info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 13.5px;
    color: var(--text);
}

.lezione-item__info span { font-weight: 600; }

.lezione-item__info em {
    font-style: normal;
    color: var(--text-muted);
    font-size: 12.5px;
}

/* QR Thumb */
.lesson-qr-thumb {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    min-width: 110px;
    transition: border-color var(--transition), background var(--transition);
}
.lesson-qr-thumb img { width: 90px; height: 90px; object-fit: contain; }
.lesson-qr-thumb span { font-size: 11px; color: var(--text-soft); font-weight: 600; }
.lesson-qr-thumb:hover { border-color: var(--primary-light); background: var(--primary-pale); }

/* QR Modal */
.lesson-qr-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.6);
    backdrop-filter: blur(4px);
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 140;
}

.lesson-qr-modal.is-visible { opacity: 1; pointer-events: auto; }

.lesson-qr-modal__content {
    background: var(--surface);
    border-radius: var(--radius-2xl);
    padding: 24px 24px 16px;
    text-align: center;
    max-width: 480px;
    width: 100%;
    position: relative;
    box-shadow: var(--shadow-xl);
}
.lesson-qr-modal__content img { width: min(350px, 70vw); height: auto; }

.lesson-qr-modal__link {
    display: inline-flex;
    margin-top: 12px;
    border: 1px solid var(--text);
    color: var(--text);
    padding: 8px 18px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: background var(--transition), color var(--transition);
}
.lesson-qr-modal__link:hover {
    background: var(--text);
    color: #fff;
}

.lesson-qr-modal__close {
    position: absolute;
    top: 12px; right: 14px;
    border: none;
    background: transparent;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
}
.lesson-qr-modal__close:hover { color: var(--text); }

.lesson-qr-modal__backdrop { position: absolute; inset: 0; }

/* ── MOBILE RESPONSIVE ───────────────────────────────────────── */
@media (max-width: 1600px) {
    .dashboard-service-grid { grid-template-columns: 1.2fr 1fr 1fr 1fr; }
    .dashboard-service-card { padding: 14px; }
}

@media (max-width: 1380px) {
    .dashboard-overview__intro { font-size: 13px; }
    .dashboard-kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .dashboard-service-grid,
    .amm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
    :root {
        --topnav-h: var(--topnav-h-mobile);
        --page-gutter: 16px;
    }

    body { padding-top: var(--topnav-h-mobile); }

    .topnav {
        height: var(--topnav-h-mobile);
        min-height: var(--topnav-h-mobile);
        padding-left: var(--page-gutter);
        padding-right: var(--page-gutter);
    }

    .nav-toggle { display: block; }

    .nav-brand {
        gap: clamp(10px, calc(var(--topnav-h-mobile, 56px) / 9), 16px);
    }

    .nav-brand > img:first-child {
        height: clamp(42px, calc(var(--topnav-h-mobile, 56px) / 1.9), 60px);
        width: auto;
    }

    .hilogo {
        height: clamp(56px, calc(var(--topnav-h-mobile, 56px) / 1.45), 80px);
    }

    .dashboard-intro {
        gap: clamp(8px, calc(var(--topnav-h-mobile, 56px) / 10), 14px);
    }

    .dashboard-intro .user-icon {
        height: clamp(36px, calc(var(--topnav-h-mobile, 56px) / 2.3), 48px);
        padding: 3px;
    }

    .barra-col {
        height: clamp(42px, calc(var(--topnav-h-mobile, 56px) / 1.9), 60px);
    }

    .dashboard-ruolo {
        font-size: clamp(10.5px, calc(var(--topnav-h-mobile, 56px) / 8.6), 13px);
    }

    .dashboard-nome {
        font-size: clamp(14px, calc(var(--topnav-h-mobile, 56px) / 5.8), 18px);
    }

    .nav-links {
        display: none;
        background: rgba(17,24,39,.97);
        width: 100%;
        position: absolute;
        top: 100%;
        left: 0;
        padding: 12px;
        box-shadow: var(--shadow-lg);
        border-bottom-left-radius: var(--radius-xl);
        border-bottom-right-radius: var(--radius-xl);
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 8px;
    }

    .topnav.active .nav-links { display: grid; }

    .nav-links a {
        margin: 0;
        text-align: center;
        font-size: clamp(24px, calc(var(--topnav-h-mobile, 56px) / 6), 17px);
        padding: clamp(12px, calc(var(--topnav-h-mobile, 56px) / 8), 16px) 12px;
        min-height: clamp(48px, calc(var(--topnav-h-mobile, 56px) / 1.9), 60px);
        border-radius: var(--radius);
        background: rgba(255,255,255,.06);
        border: 1px solid rgba(255,255,255,.08);
        flex-direction: column;
        gap: 4px;
        color: var(--nav-links-color, #ffffff);
        opacity: var(--nav-links-opacity, 0.72);
    }

    .nav-links .icon { height: 32px; }

    .dashboard-intro h1,
    .dashboard-intro p { font-size: 13px; }

    /* Touch-friendly sizing — refined, not oversized */
    table { font-size: 15px; }
    ul    { font-size: 15px; }
    h2    { font-size: 19px; }

    .admin-links a { font-size: 15px; width: auto; padding: 10px 14px; }
    .box           { font-size: 15px; padding: 18px 16px; }

    .boxlogin {
        font-size: 16px;
        max-width: 92%;
        margin: 24px auto;
        padding: 28px 22px;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    select,
    textarea { font-size: 16px; padding: 12px 14px; }

    button { font-size: 15px; }
    p      { font-size: 14.5px; }
    form label { font-size: 14px !important; }

    .admin-groups-row { flex-direction: column; }

    .main { padding: 16px 14px; margin-top: 0; }

    .sidebar {
        width: 100%;
        flex-direction: row;
        justify-content: space-around;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 10px;
    }

    .grid-3, .grid-2, .grid-4 { grid-template-columns: 1fr; }

    .divdoc { padding-left: 0; }
}

@media (max-width: 860px) {
    .dashboard-kpi-grid,
    .dashboard-service-grid,
    .amm-grid { grid-template-columns: 1fr; }
    .guide-banner {
        flex-direction: column;
        align-items: stretch;
    }
    .guide-banner__button { width: 100%; }
}

@media (max-width: 1024px) {
    :root {
        --topnav-h-mobile: 74px;
        --topnav-h: var(--topnav-h-mobile);
    }

    body {
        padding-top: var(--topnav-h-mobile);
    }

    .topnav {
        height: var(--topnav-h-mobile);
        min-height: var(--topnav-h-mobile);
        padding-left: 12px;
        padding-right: 12px;
    }

    .topnav-inner {
        min-height: calc(var(--topnav-h-mobile) - 8px);
        gap: clamp(10px, calc(var(--topnav-h-mobile, 56px) / 8), 14px);
    }

    .nav-brand {
        gap: 10px;
        min-width: 0;
    }

    .nav-brand > img:first-child {
        height: clamp(40px, calc(var(--topnav-h-mobile, 56px) / 2), 56px);
        width: auto;
    }

    .hilogo {
        height: clamp(54px, calc(var(--topnav-h-mobile, 56px) / 1.5), 74px);
    }

    .dashboard-intro {
        margin-left: 4px;
        gap: clamp(8px, calc(var(--topnav-h-mobile, 56px) / 10), 12px);
        min-width: 0;
    }

    .dashboard-intro h1,
    .dashboard-intro p,
    .dashboard-nome {
        font-size: clamp(14px, calc(var(--topnav-h-mobile, 56px) / 5.9), 18px);
        line-height: 1.2;
    }

    .dashboard-ruolo {
        font-size: clamp(10.5px, calc(var(--topnav-h-mobile, 56px) / 8.8), 13px);
    }

    .dashboard-intro .user-icon {
        height: clamp(34px, calc(var(--topnav-h-mobile, 56px) / 2.35), 46px);
    }

    .barra-col {
        height: clamp(42px, calc(var(--topnav-h-mobile, 56px) / 1.95), 56px);
    }

    .nav-toggle {
        width: clamp(46px, calc(var(--topnav-h-mobile, 56px) / 1.95), 54px);
        height: clamp(46px, calc(var(--topnav-h-mobile, 56px) / 1.95), 54px);
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 clamp(46px, calc(var(--topnav-h-mobile, 56px) / 1.95), 54px);
        font-size: clamp(70px, calc(var(--topnav-h-mobile, 56px) / 3.7), 30px);
    }

    .main { padding: 12px; }
    .page-header { flex-direction: column; }
    .page-header-actions { width: 100%; }
    .admin-groups-row {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
        gap: 10px;
    }
    .admin-menu-group { width: 100%; }
    .admin-group-toggle {
        min-height: 48px;
        justify-content: space-between;
    }
    .admin-submenu {
        width: 100%;
        margin-top: 8px;
        padding: 10px;
        background: var(--surface-2);
        border-radius: var(--radius);
        border: 1px solid var(--border);
        box-shadow: var(--shadow-xs);
    }
    .admin-submenu.is-open {
        display: flex !important;
        flex-wrap: wrap;
        gap: 6px;
    }
}

@media (max-width: 480px) {
    :root {
        --topnav-h-mobile: 78px;
        --topnav-h: var(--topnav-h-mobile);
    }

    .topnav {
        padding-left: 10px;
        padding-right: 10px;
    }

    .nav-brand > img:first-child {
        height: clamp(36px, calc(var(--topnav-h-mobile, 56px) / 2.1), 48px);
    }

    .hilogo {
        height: clamp(50px, calc(var(--topnav-h-mobile, 56px) / 1.55), 66px);
    }

    .dashboard-intro h1,
    .dashboard-intro p,
    .dashboard-nome {
        font-size: clamp(13px, calc(var(--topnav-h-mobile, 56px) / 6.3), 16px);
    }
}

@media (max-width: 600px) {
    .riga-orari { flex-direction: column; }
    .riga-assegnazione-studente { flex-direction: column; align-items: flex-start; }
    .form-modifica-assegnazione,
    .form-elimina-assegnazione { width: 100%; justify-content: flex-start; }
    .form-modifica-assegnazione select { width: 100%; }
}

/* ── SCROLLBAR ──────────────────────────────────────────────── */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

/* ── FOCUS RING ─────────────────────────────────────────────── */
:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}

/* ── RESPONSIVE EXTRA ────────────────────────────────────────── */
@media (max-width: 768px) {
    .main { padding: 14px; }
    .page-header { flex-direction: column; }
    .page-header-actions { width: 100%; }
}

/* ===== Docenti & Corsi: PDF check ente (trigger + modal) ===== */
.docente-pdf-enti {
    display: flex;
}
.docente-pdf-enti__trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #2563eb;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.docente-pdf-enti__trigger:hover {
    background: #dbeafe;
    color: #1e40af;
}
.docente-pdf-enti__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #1d4ed8;
    color: #fff;
    font-size: 12px;
}
.pdf-enti-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}
.pdf-enti-modal--visible {
    display: flex;
}
.pdf-enti-modal__dialog {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    max-width: 460px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 70px rgba(15, 23, 42, 0.35);
}
.pdf-enti-modal__dialog h2 {
    margin: 0 0 4px;
    font-size: 20px;
    color: #0f172a;
}
.pdf-enti-modal__close {
    position: absolute;
    top: 10px;
    right: 12px;
    border: none;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #475569;
}
.pdf-enti-modal__docente {
    margin: 0 0 2px;
    font-weight: 700;
    color: #1d4ed8;
}
.pdf-enti-modal__hint {
    margin: 0 0 16px;
    font-size: 13px;
    color: #475569;
}
.pdf-enti-modal__list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.pdf-enti-modal__list .btn-pdf-ente {
    width: 100%;
    justify-content: flex-start;
    white-space: normal;
    text-align: left;
}
.btn-pdf-ente {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid #2563eb;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}
.btn-pdf-ente:hover {
    background: #dbeafe;
    color: #1e40af;
    text-decoration: none;
}
