/* Layout pubblico, dashboard, admin */
.container {
    width: min(1100px, 92vw);
    margin: 0 auto;
}
.container--narrow {
    width: min(440px, 92vw);
}
.container-fluid {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
}
.dash-padding {
    padding: 1rem 0 1.25rem;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.layout-public .main-content {
    padding-bottom: 3rem;
}

/* Header pubblico — stile mockup */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
    background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 0 rgba(0, 123, 255, 0.08);
}
.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 0;
}
.brand {
    font-weight: 800;
    letter-spacing: -0.03em;
    font-size: 1.25rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.brand__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gradient-brand);
    box-shadow: 0 0 12px var(--primary-glow);
}
.site-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.site-nav a {
    color: var(--text);
}
.logout-form {
    display: inline;
    margin: 0;
}
.nav-toggle {
    display: none;
    background: var(--surface-2);
    border: none;
    border-radius: var(--radius);
    padding: 0.35rem 0.6rem;
    box-shadow: var(--shadow-card);
}
@media (max-width: 720px) {
    .nav-toggle {
        display: inline-block;
    }
    .site-nav {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    .site-nav.is-open {
        display: flex;
    }
}

/* Hero */
.hero {
    padding: 3rem 0 2rem;
}
.hero__grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 2rem;
    align-items: start;
}
@media (max-width: 900px) {
    .hero__grid {
        grid-template-columns: 1fr;
    }
}
.hero h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    line-height: 1.15;
    margin: 0.5rem 0 1rem;
}
.lead {
    font-size: 1.05rem;
    color: var(--muted);
    line-height: 1.6;
}
.hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.25rem;
}
.section {
    padding: 2.5rem 0;
}
.section--alt {
    background: var(--surface-2);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.plans--3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}
@media (max-width: 900px) {
    .plans--3 {
        grid-template-columns: 1fr;
    }
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}
@media (max-width: 900px) {
    .feature-grid {
        grid-template-columns: 1fr;
    }
}

.site-footer {
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    margin-top: 2rem;
    background: var(--surface);
}
.site-footer.site-footer--mock {
    margin-top: 0;
}
.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}
@media (max-width: 900px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}
.footer-links {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0;
}
.footer-links li {
    margin: 0.25rem 0;
}
.muted {
    color: var(--muted);
}
.small {
    font-size: 0.9rem;
}

/* App frame — 3 colonne a tutta altezza, senza header fisso */
.layout-app {
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
}
.app-frame {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 100vh;
    background: var(--bg);
}
.app-body {
    --side-col: var(--sidebar-w, 270px);
    --rail-col: 0px;
    --gap: var(--shell-gap, 24px);
    position: relative;
    display: grid;
    grid-template-columns: var(--side-col) minmax(0, 1fr) var(--rail-col);
    column-gap: 0;
    row-gap: 0;
    padding: var(--gap);
    box-sizing: border-box;
    flex: 1;
    min-height: 0;
    height: 100%;
    transition: grid-template-columns var(--motion-panel) ease;
}
html.is-rail-open .app-body {
    --rail-col: var(--rail-w, 300px);
}
html.is-sidebar-icons .app-body {
    --side-col: var(--sidebar-icons-w, 88px);
}
html.is-sidebar-collapsed .app-body {
    --side-col: 0px;
}
.app-column {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
    min-height: 0;
    gap: var(--gap);
    margin-inline: var(--main-inline, 2.5rem);
    padding-inline: 0;
}
.app-column > .app-header-slot,
.app-column > .app-scroll-wrap {
    width: 100%;
    max-width: var(--main-max, 960px);
    margin-inline: auto;
}
/* Collassa lo slot: il main sale e recupera lo spazio dell’header */
.app-header-slot {
    flex-shrink: 0;
    max-height: 14rem; /* >= header anche su layout a due righe */
    overflow: visible; /* dropdown notifiche / menu */
    transition: max-height 0.28s ease, margin-bottom 0.28s ease;
}
.app-header-slot > .main-header {
    transition: opacity 0.22s ease, transform 0.28s ease;
    will-change: opacity, transform;
}
html.is-header-hidden .app-header-slot {
    max-height: 0;
    overflow: hidden;
    pointer-events: none;
    margin-bottom: calc(-1 * var(--gap)); /* annulla il gap della colonna */
}
html.is-header-hidden .app-header-slot > .main-header {
    opacity: 0;
    transform: translateY(-0.35rem);
    pointer-events: none;
}
html.is-sidebar-collapsed .sidebar {
    overflow: hidden;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    margin: 0;
    border: 0;
    box-shadow: none;
    visibility: hidden;
}

/* Sidebar flottante stile Spike */
.sidebar {
    --sidebar-text: var(--color-text-muted);
    --sidebar-heading: var(--color-text-muted);
    --sidebar-line: var(--color-border);
    background: var(--color-surface);
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    padding: 1.15rem 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    z-index: 20;
    margin-right: 0;
}
.sidebar__scroll-wrap {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.sidebar__brand {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.65rem;
    flex-shrink: 0;
    margin: 0 0.15rem 1.35rem;
    text-decoration: none;
    color: var(--color-text);
}
.sidebar__brand:hover {
    text-decoration: none;
    filter: brightness(1.05);
}
.sidebar__logo {
    display: block;
    object-fit: contain;
    flex-shrink: 0;
}
.sidebar__logo--full {
    width: auto;
    max-width: calc(100% - 48px);
    height: 32px;
}
.sidebar__logo--theme-dark {
    display: none;
}
[data-theme="dark"] .sidebar__logo--theme-light {
    display: none;
}
[data-theme="dark"] .sidebar__logo--theme-dark {
    display: block;
}
.sidebar__logo--mark {
    display: block;
    width: 36px;
    height: 36px;
    border-radius: 10px;
}
.sidebar__brand-text {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
}
[data-theme="dark"] .sidebar {
    --sidebar-text: var(--color-text-muted);
}
.sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding-right: 0.15rem;
    /* gutter sempre riservato: la thumb appare senza spostare il contenuto */
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}
.sidebar__nav:hover,
.sidebar__nav:focus-within {
    scrollbar-color: color-mix(in srgb, var(--color-text-muted) 32%, transparent) transparent;
}
.sidebar__nav::-webkit-scrollbar {
    width: 8px;
}
.sidebar__nav::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar__nav::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
.sidebar__nav:hover::-webkit-scrollbar-thumb,
.sidebar__nav:focus-within::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--color-text-muted) 32%, transparent);
    background-clip: padding-box;
}
.sidebar__nav:hover::-webkit-scrollbar-thumb:hover,
.sidebar__nav:focus-within::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--color-text-muted) 50%, transparent);
    background-clip: padding-box;
}
/* Modalità icone: niente gutter scrollbar (allargava inutilmente la colonna) */
html.is-sidebar-icons .sidebar,
html.is-sidebar-icons .sidebar__nav {
    scrollbar-gutter: auto;
    scrollbar-width: none;
}
html.is-sidebar-icons .sidebar::-webkit-scrollbar,
html.is-sidebar-icons .sidebar__nav::-webkit-scrollbar {
    width: 0;
    height: 0;
}
.sidebar__heading {
    margin: 0 0 0.45rem;
    padding: 0 0.75rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sidebar-heading);
}
.sidebar__heading--after {
    margin-top: 1.1rem;
    padding-top: 0.15rem;
}
.sidebar__link {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    min-height: 48px;
    padding: 0.55rem 0.85rem;
    border-radius: 10px;
    color: var(--sidebar-text);
    background: transparent;
    cursor: pointer;
    text-decoration: none;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.2;
    border: 0;
    text-align: left;
    transition: background 0.15s ease, color 0.15s ease;
}
.sidebar__link:hover {
    text-decoration: none;
    color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary) 8%, transparent);
}
.sidebar__link.is-active {
    color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary) 12%, transparent);
    font-weight: 600;
    box-shadow: none;
}
.sidebar__link.is-active:hover {
    color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary) 16%, transparent);
    filter: none;
}
[data-theme="dark"] .sidebar__link.is-active {
    color: var(--color-primary);
}
.sidebar__ico {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    color: inherit;
}
.sidebar__ico svg {
    width: 20px;
    height: 20px;
}
.sidebar__label {
    min-width: 0;
    flex: 1;
}
.sidebar__favorites {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.sidebar__fav-empty {
    margin: 0;
    padding: 0.35rem 0.85rem 0.55rem;
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--color-text-muted);
}
.sidebar__fav-empty a {
    font-weight: 600;
}
.sidebar__link--fav {
    min-height: 40px;
    padding: 0.4rem 0.75rem;
    font-size: 0.88rem;
}
.sidebar__ico--fav img {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    object-fit: contain;
    display: block;
}

/* Modalità solo icone — tooltip floating via JS (position:fixed), niente overflow fuori pannello */
html.is-sidebar-icons .sidebar {
    padding: 0.85rem 0.5rem 1rem;
    overflow-x: hidden;
    overflow-y: auto;
    z-index: 40;
}
html.is-sidebar-icons .sidebar__scroll-wrap {
    overflow: hidden;
    min-height: 0;
    flex: 1;
}
html.is-sidebar-icons .sidebar__nav {
    overflow-x: hidden;
    overflow-y: auto;
    align-items: center;
    gap: 0.25rem;
    padding-right: 0;
}
html.is-sidebar-icons .sidebar__brand {
    justify-content: center;
    gap: 0;
    margin: 0 0 1.1rem;
}
html.is-sidebar-icons .sidebar__brand-text,
html.is-sidebar-icons .sidebar__heading,
html.is-sidebar-icons .sidebar__logo--full,
html.is-sidebar-icons .sidebar__fav-empty {
    display: none;
}
html.is-sidebar-icons .sidebar__logo--mark {
    display: block;
    width: 42px;
    height: 42px;
    border-radius: 12px;
}
html.is-sidebar-icons .sidebar__favorites {
    align-items: center;
    width: 100%;
}
html.is-sidebar-icons .sidebar__link {
    position: relative;
    justify-content: center;
    width: 48px;
    min-height: 48px;
    padding: 0.65rem;
    border-radius: 12px;
}
/* Label nascoste nel flusso: il testo serve al tooltip JS */
html.is-sidebar-icons .sidebar__label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

/* Tooltip sidebar (fuori dal pannello, sopra tutto) */
.sidebar-flyout-tip {
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    max-width: 14rem;
    padding: 0.45rem 0.75rem;
    border-radius: 10px;
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    box-shadow: var(--shadow-floating);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-50%);
    transition: opacity var(--motion-fast) ease, visibility var(--motion-fast) ease;
}
.sidebar-flyout-tip.is-visible {
    opacity: 1;
    visibility: visible;
}
.sidebar-flyout-tip::before {
    content: "";
    position: absolute;
    left: -5px;
    top: 50%;
    width: 10px;
    height: 10px;
    background: var(--color-surface);
    transform: translateY(-50%) rotate(45deg);
    box-shadow: -2px 2px 4px rgba(37, 83, 185, 0.06);
}

/* Rail destra — colonna grid (ridimensiona il main), aperta di default */
.rail {
    --rail-muted: var(--color-text-muted);
    position: relative;
    z-index: 20;
    width: 100%;
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1.15rem 1rem 1.2rem;
    overflow: hidden;
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity var(--motion-fast) ease, visibility var(--motion-fast) ease;
}
.rail__scroll-wrap {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
html.is-rail-open .rail {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}
html:not(.is-rail-open) .rail {
    padding: 0;
    border: 0;
    box-shadow: none;
    overflow: hidden;
}
.rail__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    flex-shrink: 0;
}
.rail__body {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    min-height: 0;
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
    padding-right: 0.1rem;
    scrollbar-width: none;
}
.rail__body:hover,
.rail__body:focus-within {
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--color-text-muted) 28%, transparent) transparent;
}
.rail__body::-webkit-scrollbar {
    width: 0;
}
.rail__body:hover::-webkit-scrollbar,
.rail__body:focus-within::-webkit-scrollbar {
    width: 6px;
}
.rail__body::-webkit-scrollbar-track {
    background: transparent;
}
.rail__body::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 999px;
}
.rail__body:hover::-webkit-scrollbar-thumb,
.rail__body:focus-within::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--color-text-muted) 32%, transparent);
}
.panel-scroll-fade {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3.25rem;
    pointer-events: none;
    z-index: 4;
    opacity: 0;
    transition: opacity 0.2s ease;
    background: linear-gradient(
        to top,
        color-mix(in srgb, var(--color-surface) 92%, transparent) 0%,
        color-mix(in srgb, var(--color-surface) 55%, transparent) 45%,
        transparent 100%
    );
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}
.sidebar__scroll-wrap.is-scrollable:not(.is-at-bottom) .panel-scroll-fade,
.rail__scroll-wrap.is-scrollable:not(.is-at-bottom) .panel-scroll-fade {
    opacity: 1;
}
.rail-card--profile {
    text-align: center;
    padding-top: 1.15rem;
}
.rail-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}
.rail-profile__avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: var(--shadow-soft);
}
.rail-profile__avatar--fallback {
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, #1a86ff, #ff8a3c);
    color: #fff;
    font-weight: 800;
    font-size: 1.45rem;
}
.rail-profile__name {
    margin: 0.45rem 0 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--topbar-fg);
}
.rail-profile__role {
    margin: 0;
    font-size: 0.85rem;
    color: var(--rail-muted);
}
.rail-profile__menu {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: center;
    margin-top: 0.55rem;
}
.rail-profile__stats {
    list-style: none;
    margin: 1rem 0 0;
    padding: 0.85rem 0 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35rem;
    border-top: 1px solid color-mix(in srgb, var(--topbar-fg) 10%, transparent);
}
.rail-profile__stats li {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.rail-profile__stats strong {
    font-size: 0.95rem;
    color: var(--topbar-fg);
}
.rail-profile__stats span {
    font-size: 0.72rem;
    color: var(--rail-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.rail-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}
.rail-user__avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: var(--shadow-card);
}
.rail-user__avatar--fallback {
    display: grid;
    place-items: center;
    background: var(--color-primary);
    color: var(--btn-primary-fg);
    font-weight: 700;
    font-size: 0.95rem;
}
.rail-user__meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.rail-user__name {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rail-user__role {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}
.main-legal {
    margin-top: 2rem;
    padding-top: 0.85rem;
    border-top: 1px solid color-mix(in srgb, var(--color-border) 55%, transparent);
    font-size: 0.68rem;
    line-height: 1.45;
    color: var(--color-text-muted);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem 1rem;
}
.main-legal__copy {
    margin: 0;
}
.main-legal__links {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.35rem;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
}
.main-legal__links a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.main-legal__links a:hover {
    color: var(--color-text);
}
.legal-page__body {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    padding: 1.25rem 1.35rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.legal-page__body p {
    margin: 0;
    color: var(--color-text);
    line-height: 1.6;
    font-size: 0.95rem;
}
.rail-card {
    background: color-mix(in srgb, var(--color-surface) 55%, var(--color-surface-soft));
    border: 1px solid color-mix(in srgb, var(--color-border) 55%, transparent);
    border-radius: var(--radius-xl);
    padding: 0.95rem 0.9rem 1rem;
    box-shadow: none;
}
[data-theme="dark"] .rail-card {
    background: color-mix(in srgb, var(--color-surface-soft) 80%, transparent);
}
.rail-card__head {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 0.85rem;
}
.rail-card__head--simple {
    margin-bottom: 0.75rem;
}
.rail-card__title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--topbar-fg);
    line-height: 1.25;
}
.rail-card__sub {
    margin: 0.15rem 0 0;
    font-size: 0.8rem;
    color: var(--rail-muted);
}
.rail-card__accent {
    width: 22px;
    height: 22px;
    color: #ff8c00;
    flex-shrink: 0;
    display: grid;
    place-items: center;
}
.rail-card__accent svg {
    width: 20px;
    height: 20px;
}
.rail-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(145deg, #3a4a5c, #1a2431);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}
.rail-stats {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.rail-stats li {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    align-items: center;
    gap: 0.55rem;
}
.rail-stats__ico {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    display: grid;
    place-items: center;
}
.rail-stats__ico svg {
    width: 15px;
    height: 15px;
}
.rail-stats__ico--orange {
    background: rgba(255, 140, 0, 0.16);
    color: #ff8c00;
}
.rail-stats__ico--blue {
    background: rgba(26, 134, 255, 0.16);
    color: #3b9bff;
}
.rail-stats__ico--green {
    background: rgba(34, 197, 94, 0.16);
    color: #22c55e;
}
.rail-stats__label {
    font-size: 0.82rem;
    color: var(--rail-muted);
}
.rail-stats__val {
    font-size: 0.95rem;
    color: var(--topbar-fg);
    font-weight: 700;
}
.rail-level {
    margin-top: 0.9rem;
}
.rail-level__row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--rail-muted);
    margin-bottom: 0.4rem;
}
.rail-level__row strong {
    color: var(--topbar-fg);
}
.rail-level__bar {
    height: 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--topbar-fg) 10%, transparent);
    overflow: hidden;
}
.rail-level__bar > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--color-primary), var(--color-coral));
}
.rail-badges {
    list-style: none;
    margin: 0.85rem 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.rail-badges__item {
    margin: 0;
}
.rail-badges__ico {
    display: grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: var(--radius-pill, 999px);
    background: var(--surface-2, color-mix(in srgb, var(--topbar-fg) 8%, transparent));
    color: var(--color-primary);
    font-size: 0.7rem;
    font-weight: 700;
}
.rail-card__footer {
    margin: 0.85rem 0 0;
}
.rail-card__link {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
}
.rail-card__link:hover {
    text-decoration: underline;
}
.rail-card__empty {
    margin: 0.5rem 0 0;
    font-size: 0.85rem;
    color: var(--rail-muted);
}
.rail-card__sub--rank {
    margin-top: 0.65rem;
}
.rail-rank li.is-me {
    background: color-mix(in srgb, var(--color-primary) 8%, transparent);
    border-radius: var(--radius-md, 10px);
}
.rail-promo {
    border-radius: 14px;
    padding: 1rem 0.9rem 0.95rem;
    background: linear-gradient(145deg, #7b5cff 0%, #3b82f6 55%, #2563eb 100%);
    color: #fff;
    text-align: left;
}
.rail-promo__ico {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    display: grid;
    place-items: center;
    margin-bottom: 0.7rem;
}
.rail-promo__ico svg {
    width: 22px;
    height: 22px;
}
.rail-promo__title {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
    font-weight: 700;
}
.rail-promo__text {
    margin: 0 0 0.85rem;
    font-size: 0.78rem;
    line-height: 1.4;
    opacity: 0.9;
}
.rail-promo__btn {
    width: 100%;
    border: 0;
    border-radius: 10px;
    padding: 0.55rem 0.75rem;
    background: rgba(255, 255, 255, 0.92);
    color: #1e293b;
    font: inherit;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: not-allowed;
    opacity: 0.95;
}
.rail-rank {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.rail-rank li {
    display: grid;
    grid-template-columns: 22px 28px 1fr auto;
    align-items: center;
    gap: 0.45rem;
}
.rail-rank__pos {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--rail-muted);
}
.rail-rank__pos svg {
    width: 16px;
    height: 16px;
}
.rail-rank__pos--1 {
    color: #f5c542;
}
.rail-rank__pos--2 {
    color: #c0c7d1;
}
.rail-rank__pos--3 {
    color: #d97706;
}
.rail-rank__avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--topbar-fg) 12%, transparent);
    color: var(--topbar-fg);
    display: grid;
    place-items: center;
    font-size: 0.72rem;
    font-weight: 700;
}
.rail-rank__meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.2;
}
.rail-rank__meta strong {
    font-size: 0.82rem;
    color: var(--topbar-fg);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rail-rank__meta span {
    font-size: 0.72rem;
    color: var(--rail-muted);
}
.rail-rank__pts {
    font-size: 0.78rem;
    font-weight: 700;
    color: #ff8c00;
    white-space: nowrap;
}
.rail-card__cta {
    width: 100%;
    margin-top: 0.85rem;
    border: 1px solid color-mix(in srgb, var(--topbar-fg) 12%, transparent);
    border-radius: 12px;
    padding: 0.55rem 0.75rem;
    background: color-mix(in srgb, var(--topbar-fg) 6%, transparent);
    color: var(--topbar-fg);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: not-allowed;
    opacity: 0.7;
}

.app-scroll-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.app-scroll {
    min-width: 0;
    min-height: 0;
    flex: 1;
    margin: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
    background: transparent;
    color: var(--color-text);
    border-radius: 0;
    box-shadow: none;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}
.app-scroll:hover,
.app-scroll:focus-within {
    scrollbar-color: color-mix(in srgb, var(--color-text-muted) 32%, transparent) transparent;
}
.app-scroll-fade {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 5.5rem;
    pointer-events: none;
    z-index: 5;
    background: linear-gradient(
        to bottom,
        color-mix(in srgb, var(--color-bg) 0%, transparent) 0%,
        color-mix(in srgb, var(--color-bg) 55%, transparent) 45%,
        var(--color-bg) 100%
    );
    opacity: 0;
    transition: opacity var(--motion-base) ease;
}
.app-scroll-wrap.is-scrollable:not(.is-at-bottom) .app-scroll-fade {
    opacity: 1;
}
.app-main {
    flex: 1 0 auto;
    width: 100%;
    max-width: var(--main-max, 960px);
    margin-inline: auto;
    min-width: 0;
}

/* Header flottante stile Spike */
.main-header {
    position: relative;
    z-index: 30;
    flex-shrink: 0;
    display: grid;
    grid-template-columns: auto minmax(100px, 0.85fr) minmax(0, 1.6fr) minmax(160px, 1.1fr);
    align-items: center;
    gap: 0.75rem 1rem;
    min-height: var(--topbar-h, 70px);
    padding: 0.7rem 1.25rem;
    background: var(--color-surface);
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}
.main-header__menu-btn {
    display: grid;
}
.main-header__clock {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}
.main-header__time {
    font-family: var(--font-heading);
    font-size: clamp(1.55rem, 2.2vw, 1.9rem);
    font-weight: 800;
    line-height: 1.05;
    color: var(--color-text);
    letter-spacing: -0.02em;
}
.main-header__date {
    font-size: 0.88rem;
    color: var(--color-text-muted);
    text-transform: capitalize;
}
.main-header__search {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    min-height: 46px;
    padding: 0 1rem;
    border-radius: var(--radius-pill);
    background: var(--color-bg);
    border: 1px solid transparent;
    box-shadow: none;
}
.main-header__search-ico {
    display: grid;
    place-items: center;
    color: var(--color-text-muted);
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    border-radius: var(--radius-sm);
}
.main-header__search-ico:hover {
    color: var(--color-text);
}
.main-header__search-ico:focus-visible {
    outline: 2px solid var(--color-focus, var(--color-primary));
    outline-offset: 2px;
}
.main-header__search-ico svg {
    width: 18px;
    height: 18px;
}
.main-header__search-input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--color-text);
    font: inherit;
    font-size: 0.95rem;
    outline: none;
}
.main-header__search-input::placeholder {
    color: var(--color-text-muted);
}
.main-header__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    min-width: 0;
}
.main-header__profile {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 42px;
    padding: 0.2rem 0.45rem 0.2rem 0.2rem;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    background: var(--color-bg);
    color: var(--color-text);
    cursor: pointer;
    font: inherit;
    transition: background var(--motion-fast) ease, box-shadow var(--motion-fast) ease, color var(--motion-fast) ease;
}
.main-header__profile:hover {
    background: var(--color-surface-hover);
    color: var(--color-primary);
}
html.is-rail-open .main-header__profile {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 35%, transparent);
}
.main-header__avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.main-header__avatar--fallback {
    display: grid;
    place-items: center;
    background: var(--color-primary);
    color: var(--btn-primary-fg);
    font-weight: 700;
    font-size: 0.88rem;
}
.main-header__profile-toggle {
    width: 18px;
    height: 18px;
    color: var(--color-text-muted);
    flex-shrink: 0;
}
.main-header__profile:hover .main-header__profile-toggle {
    color: var(--color-primary);
}
.main-header__profile-toggle-close {
    display: none;
}
html.is-rail-open .main-header__profile-toggle-open {
    display: none;
}
html.is-rail-open .main-header__profile-toggle-close {
    display: unset;
}
.main-header__icon-btn {
    position: relative;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: var(--color-bg);
    color: var(--color-text);
    display: grid;
    place-items: center;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: none;
    transition: background var(--motion-fast) ease, color var(--motion-fast) ease;
}
.main-header__icon-btn:hover {
    background: color-mix(in srgb, var(--color-primary) 10%, transparent);
    color: var(--color-primary);
}
.main-header__icon-btn svg {
    width: 18px;
    height: 18px;
}
.main-header__badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--topbar-badge);
    box-shadow: 0 0 0 2px var(--color-surface);
}
@media (max-width: 900px) {
    .main-header {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "clock actions"
            "search search";
        gap: 0.75rem;
        padding: 0.85rem 1rem;
    }
    .main-header__clock { grid-area: clock; }
    .main-header__search { grid-area: search; max-width: none; }
    .main-header__actions { grid-area: actions; }
}
@media (max-width: 720px) {
    .main-header {
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-areas:
            "menu clock actions"
            "search search search";
    }
    .main-header__menu-btn {
        grid-area: menu;
    }
}
.app-scroll::-webkit-scrollbar {
    width: 8px;
}
.app-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.app-scroll::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
.app-scroll:hover::-webkit-scrollbar-thumb,
.app-scroll:focus-within::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--color-text-muted) 32%, transparent);
    background-clip: padding-box;
    border: 2px solid transparent;
}
.app-scroll:hover::-webkit-scrollbar-thumb:hover,
.app-scroll:focus-within::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--color-text-muted) 50%, transparent);
    background-clip: padding-box;
}
/* Edge-toggle rimosso: il menu header gestisce già open/icons/closed */
.app-main > .container-fluid,
.app-main > .admin-page,
.app-main > .viewer-page,
.app-main > .catalog-page,
.app-main > .auth-page,
.app-scroll > .app-flash {
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
    box-sizing: border-box;
    overflow-x: clip;
}
.app-scroll > .app-flash {
    padding-top: 0.15rem;
    padding-bottom: 0.65rem;
}

/* Footer — trasparente, sticky bottom su pagine corte */
.dash-footer {
    width: 100%;
    max-width: none;
    margin-top: auto;
    padding: 1.5rem 1.35rem 1.1rem;
    flex-shrink: 0;
    box-sizing: border-box;
}
.dash-footer__inner {
    border-radius: 0;
    padding: 1.25rem 0 0.35rem;
    color: var(--text-dim);
    background: transparent;
    border: none;
    border-top: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
    box-shadow: none;
}
.dash-footer__cols {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem 1.5rem;
}
.dash-footer__title {
    margin: 0 0 0.85rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}
.dash-footer__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.dash-footer__list a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--muted);
    font-size: 0.88rem;
    text-decoration: none;
}
.dash-footer__list a:hover {
    color: var(--primary);
    text-decoration: none;
}
.dash-footer__list a::before {
    content: "";
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 4px 0 4px 6px;
    border-color: transparent transparent transparent var(--muted);
    flex-shrink: 0;
    opacity: 0.9;
}
.dash-footer__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.35rem;
    padding-top: 1rem;
    border-top: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
}
.dash-footer__social {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}
.dash-footer__social a {
    color: var(--muted);
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    opacity: 0.92;
}
.dash-footer__social a:hover {
    color: var(--primary);
    opacity: 1;
    text-decoration: none;
}
.dash-footer__social svg {
    width: 20px;
    height: 20px;
}
.dash-footer__legal {
    text-align: right;
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.45;
}
.dash-footer__legal p {
    margin: 0;
}
.dash-footer__legal p + p {
    margin-top: 0.2rem;
}
.dash-footer__legal a {
    color: var(--muted);
    text-decoration: none;
}
.dash-footer__legal a:hover {
    color: var(--primary);
    text-decoration: underline;
}
.dash-footer__legal span {
    margin: 0 0.35rem;
    opacity: 0.7;
}

@media (max-width: 900px) {
    .dash-footer__cols {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 560px) {
    .app-main > .container-fluid,
    .app-main > .admin-page,
    .app-main > .viewer-page,
    .app-scroll > .app-flash,
    .dash-footer {
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }
    .dash-footer {
        margin-top: 1.25rem;
    }
    .dash-footer__inner {
        padding: 1rem 0 0.25rem;
    }
    .dash-footer__cols {
        grid-template-columns: 1fr;
        gap: 1.1rem;
    }
    .dash-footer__bottom {
        flex-direction: column;
        align-items: flex-start;
    }
    .dash-footer__legal {
        text-align: left;
    }
}

.app-sidebar-backdrop {
    display: none;
}

/* Legacy topbar (non usato nella shell attuale) */
.topbar {
    display: none;
}
.topbar__left,
.topbar__right {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-shrink: 0;
    white-space: nowrap;
}
.topbar__left {
    min-width: 0;
}
.topbar__right {
    justify-content: flex-end;
    flex-shrink: 0;
}
.topbar__center {
    display: flex;
    justify-content: center;
    min-width: 0;
}
.topbar__brand {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    color: var(--topbar-logo);
    text-decoration: none;
}
.topbar__brand:hover {
    text-decoration: none;
    color: var(--topbar-logo);
    filter: brightness(1.08);
}
.topbar__logo {
    display: block;
    height: 28px;
    width: auto;
    max-width: 168px;
    object-fit: contain;
}
.topbar__brand-text {
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: 0.04em;
    color: var(--topbar-logo);
}

.topbar-search {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    max-width: 560px;
    height: 40px;
    padding: 0 1rem 0 0.9rem;
    border-radius: 999px;
    background: var(--topbar-search-bg);
    border: none;
    box-shadow: inset 0 0 0 1px var(--topbar-search-border);
}
.topbar-search__icon {
    width: 18px;
    height: 18px;
    color: var(--topbar-muted);
    flex-shrink: 0;
    display: grid;
    place-items: center;
}
.topbar-search__icon svg {
    width: 18px;
    height: 18px;
}
.topbar-search__input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--topbar-fg);
    font: inherit;
    font-size: 0.92rem;
    outline: none;
}
.topbar-search__input::placeholder {
    color: var(--topbar-muted);
}

.topbar__icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 0;
    background: var(--topbar-icon-bg);
    color: var(--topbar-icon-fg);
    display: grid;
    place-items: center;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}
.topbar__icon-btn--ghost {
    background: transparent;
    color: var(--topbar-fg);
}
.topbar__icon-btn:hover {
    filter: brightness(1.12);
}
.topbar__icon-btn svg {
    width: 20px;
    height: 20px;
}
.topbar__theme-icon--sun {
    display: none;
}
html[data-theme="light"] .topbar__theme-icon--moon {
    display: none;
}
html[data-theme="light"] .topbar__theme-icon--sun {
    display: block;
}
.topbar__badge {
    position: absolute;
    top: 5px;
    right: 6px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--topbar-badge);
    box-shadow: 0 0 0 2px var(--topbar-bg);
}

.topbar-drop {
    position: relative;
}
.topbar-profile {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 0;
    color: var(--topbar-fg);
    cursor: pointer;
    padding: 0 0.15rem 0 0;
    font: inherit;
    flex-shrink: 0;
}
.topbar-profile__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.topbar-profile__avatar--fallback {
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, #ff8c00, #c45c12);
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
}
.topbar-profile__label {
    font-size: 0.92rem;
    font-weight: 500;
}
.topbar-profile__caret {
    width: 16px;
    height: 16px;
    color: var(--topbar-muted);
}

.topbar-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 220px;
    padding: 0.45rem 0;
    background: var(--topbar-menu-bg);
    color: var(--text);
    border: 1px solid color-mix(in srgb, var(--color-border) 70%, transparent);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-floating);
    z-index: 200;
}
.rail .topbar-drop {
    position: relative;
    z-index: 210;
}
.rail .topbar-menu--notify {
    right: 0;
    left: auto;
    z-index: 220;
}
.topbar-menu--notify {
    width: min(340px, 86vw);
    padding: 0.7rem 0 0.45rem;
}
.topbar-menu__title {
    margin: 0;
    padding: 0 0.9rem 0.45rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}
.topbar-menu__list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 280px;
    overflow: auto;
}
.topbar-menu__item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.65rem 0.9rem;
    border-top: 1px solid var(--border);
}
.topbar-menu__item strong {
    font-size: 0.88rem;
}
.topbar-menu__item span {
    font-size: 0.8rem;
    color: var(--muted);
}
.topbar-menu__foot {
    margin: 0.35rem 0 0;
    padding: 0.4rem 0.9rem 0.2rem;
}
.topbar-menu__link {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.55rem 0.9rem;
    color: var(--text);
    background: none;
    border: 0;
    font: inherit;
    cursor: pointer;
    text-decoration: none;
}
.topbar-menu__link:hover {
    background: var(--primary-dim);
    text-decoration: none;
}
.topbar-menu__link.is-disabled {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}
.topbar-menu form {
    margin: 0;
}

.app-rail-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 55;
    border: 0;
    padding: 0;
    background: rgba(24, 21, 39, 0.35);
}
.app-rail-backdrop[hidden] {
    display: none !important;
}

@media (max-width: 1100px) {
    .app-column {
        --main-inline: 1.5rem;
    }
}

@media (max-width: 720px) {
    .main-header__icon-btn,
    .topbar__icon-btn {
        width: 36px;
        height: 36px;
    }
    .app-body,
    html.is-sidebar-collapsed .app-body,
    html.is-rail-open .app-body {
        grid-template-columns: 1fr !important;
        --rail-col: 0px;
        padding: 12px;
    }
    .app-column {
        margin-inline: 0.35rem;
    }
    .sidebar {
        position: fixed;
        z-index: 55;
        top: 12px;
        left: 12px;
        bottom: 12px;
        width: min(270px, 86vw);
        height: auto;
        transform: translateX(calc(-100% - 24px));
        transition: transform 0.2s ease;
        overflow: auto !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        padding: 1rem !important;
        box-shadow: var(--shadow-lift);
        background: var(--color-surface);
        border-radius: var(--radius-xl);
    }
    .app-scroll {
        margin: 0;
        flex: 1;
        min-height: 0;
    }
    html.is-sidebar-open .sidebar {
        transform: translateX(0);
    }
    .app-sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 50;
        border: 0;
        padding: 0;
        background: rgba(21, 32, 43, 0.35);
    }
    .app-sidebar-backdrop[hidden] {
        display: none;
    }
    /* Mobile: rail overlay (troppo stretto per 3 colonne) */
    .rail {
        position: fixed;
        z-index: 60;
        top: 12px;
        right: 12px;
        bottom: 12px;
        width: min(300px, 88vw);
        height: auto;
        transform: translateX(calc(100% + 24px));
        transition: transform 0.2s ease, opacity 0.2s ease;
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
        padding: 1.15rem 1rem 1.2rem !important;
        box-shadow: var(--shadow-lift) !important;
    }
    html.is-rail-open .rail {
        transform: translateX(0);
    }
    html:not(.is-rail-open) .rail {
        pointer-events: none;
    }
    html.is-rail-open .app-rail-backdrop:not([hidden]) {
        display: block;
    }
}

.dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}
.dash-grid--3 {
    grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 960px) {
    .dash-grid,
    .dash-grid--3 {
        grid-template-columns: 1fr;
    }
}

.dash-hero {
    margin-bottom: 1rem;
}

.course-row {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.75rem;
}
.mini-course {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 0.75rem;
    align-items: center;
}
.mini-course__thumb {
    height: 44px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #0b6efd55, #ff8c0055);
    border: none;
    box-shadow: var(--shadow-card);
}

.stat-bars > div {
    margin: 0.5rem 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.stat-big {
    font-size: 2.25rem;
    font-weight: 800;
    margin: 0.25rem 0;
}

.tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}
.tile {
    padding: 0.5rem 0.75rem;
    border-radius: 999px;
    border: none;
    background: var(--surface-2);
    font-size: 0.9rem;
    box-shadow: var(--shadow-card);
}

.notif-list {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0;
}
.notif-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

/* Admin */
.layout-admin {
    min-height: 100vh;
}
.admin-toolbar {
    display: flex;
    justify-content: flex-end;
    padding: 0.5rem 1rem 0;
}
.admin-wrap {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1rem;
    padding: 1rem 1.35rem;
    max-width: none;
    width: 100%;
    margin: 0;
    box-sizing: border-box;
}
@media (max-width: 720px) {
    .admin-wrap {
        grid-template-columns: 1fr;
    }
}
.admin-nav {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    height: fit-content;
    position: sticky;
    top: 1rem;
}
.admin-nav a {
    color: var(--text);
}
.admin-nav__title {
    display: block;
    margin-bottom: 0.5rem;
}
.admin-main {
    min-width: 0;
}
.is-disabled {
    opacity: 0.55;
    pointer-events: none;
}

.card--center {
    text-align: center;
}
