.mm-topbar-page-context {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    min-width: 0;
}

.mm-topbar-page-context[hidden],
.mm-topbar-page-context__fallback[hidden] {
    display: none !important;
}

.mm-topbar-page-context__fallback {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    min-width: 0;
}

.mm-topbar-page-context > .mm-page-header {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: .8rem;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.mm-topbar-page-context .mm-page-header__row {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-width: 0;
}

.mm-topbar-page-context .mm-page-header__content {
    display: flex;
    flex: 1 1 auto;
    align-items: baseline;
    gap: .9rem;
    min-width: 0;
}

.mm-topbar-page-context .mm-page-header__title {
    display: flex;
    flex: 0 1 auto;
    align-items: baseline;
    gap: .45rem;
    min-width: 0;
    margin: 0;
    color: var(--mm-text);
    font-size: 1.22rem;
    font-weight: 720;
    line-height: 1.15;
    letter-spacing: -.015em;
    white-space: nowrap;
}

.mm-topbar-page-context .mm-page-header__description,
.mm-topbar-page-context .mm-page-header__archive-description {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0 !important;
    overflow: hidden;
    color: var(--mm-muted) !important;
    font-size: .86rem;
    font-weight: 500;
    line-height: 1.35;
    letter-spacing: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mm-topbar-page-context .mm-page-header__actions,
.mm-topbar-page-context .mm-page-header__badges {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    gap: .6rem;
    min-width: 0;
}

.mm-topbar-page-context .mm-page-header__actions {
    flex-wrap: nowrap;
}

.mm-topbar-page-context .mm-page-header__badges {
    flex-wrap: wrap;
}

.mm-topbar-page-context .mm-page-header__actions > :where(a, button),
.mm-topbar-page-context .mm-page-header__badges > * {
    margin-block: 0;
}

.mm-topbar-page-context .mm-page-header--legacy .mm-page-header__content {
    gap: .75rem;
}

/* Titoli e label dell'area riservata sono testo di interfaccia, non testo
   editabile: evita il cursore a I e la selezione/caret accidentale.
   I veri controlli di input mantengono invece il comportamento standard. */
.mm-app-body h1,
.mm-app-body h2,
.mm-app-body h3,
.mm-app-body h4,
.mm-app-body h5,
.mm-app-body h6,
.mm-app-body legend,
.mm-app-body label,
.mm-app-body .mm-page-header__description,
.mm-app-body .mm-page-header__archive-description,
.mm-app-body .mm-topbar-title strong {
    cursor: default;
    -webkit-user-select: none;
    user-select: none;
}

.mm-app-body input,
.mm-app-body textarea,
.mm-app-body [contenteditable="true"] {
    cursor: text;
    -webkit-user-select: text;
    user-select: text;
}

.mm-topbar-system-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: .5rem;
}

.mm-topbar--page-context .mm-topbar-system-actions:empty {
    display: none;
}

.mm-sidebar-user {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-height: 64px;
    padding: .7rem 1rem;
    border-bottom: 1px solid var(--mm-border-muted);
    color: var(--mm-text);
    text-decoration: none;
}

.mm-sidebar-user:hover,
.mm-sidebar-user:focus-visible {
    color: var(--mm-text);
    background: rgba(88, 166, 255, .055);
    text-decoration: none;
}

.mm-sidebar-user:focus-visible {
    outline: 3px solid rgba(88, 166, 255, .42);
    outline-offset: -3px;
}

.mm-sidebar-user__avatar {
    display: inline-grid;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(47, 129, 247, .95), rgba(124, 92, 255, .95));
}

.mm-sidebar-user__avatar-image,
.mm-sidebar-user__avatar-fallback {
    width: 100%;
    height: 100%;
}

.mm-sidebar-user__avatar-image {
    display: block;
    object-fit: cover;
}

.mm-sidebar-user__avatar-fallback {
    display: grid;
    place-items: center;
    color: #fff;
    font-size: .78rem;
    font-weight: 750;
}

.mm-sidebar-user__name {
    min-width: 0;
    overflow: hidden;
    font-size: .9rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Il footer account deve rimanere realmente ancorato al fondo della sidebar.
   Queste regole sono globali perché la sidebar è una partial condivisa e non
   deve dipendere dal CSS isolation della singola view. */
.mm-app-body > .mm-app-sidebar {
    display: flex;
    flex-direction: column;
}

.mm-app-body > .mm-app-sidebar > .mm-sidebar-inner {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    padding-bottom: 0;
}

.mm-app-body .mm-sidebar-nav {
    flex: 1 1 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.mm-app-body .mm-sidebar-account-actions {
    flex: 0 0 auto;
    margin-top: auto;
}

.mm-sidebar-collapsed .mm-app-body .mm-sidebar-user {
    justify-content: center;
    gap: 0;
    padding-inline: .5rem;
}

.mm-sidebar-collapsed .mm-app-body .mm-sidebar-user__name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
}

@media (max-width: 1100px) {
    .mm-topbar-page-context .mm-page-header__description,
    .mm-topbar-page-context .mm-page-header__archive-description {
        display: none;
    }

    .mm-topbar-page-context .archive-header-storage {
        min-width: 0;
    }

    .mm-topbar-page-context .archive-header-storage__content small {
        display: none;
    }
}

@media (max-width: 767.98px) {
    .mm-app-body .mm-topbar.mm-topbar--page-context {
        align-items: stretch;
        flex-wrap: wrap;
        padding-block: .7rem;
    }

    .mm-topbar-page-context {
        align-items: stretch;
        width: 100%;
    }

    .mm-topbar-page-context > .mm-page-header,
    .mm-topbar-page-context .mm-page-header__row {
        align-items: stretch;
        flex-direction: column;
        gap: .55rem;
    }

    .mm-topbar-page-context .mm-page-header__content {
        align-items: flex-start;
        flex-direction: column;
        gap: .12rem;
    }

    .mm-topbar-page-context .mm-page-header__title {
        white-space: normal;
    }

    .mm-topbar-page-context .mm-page-header__description,
    .mm-topbar-page-context .mm-page-header__archive-description {
        display: block;
        overflow: visible;
        white-space: normal;
    }

    .mm-topbar-page-context .mm-page-header__actions,
    .mm-topbar-page-context .mm-page-header__badges {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .mm-sidebar-collapsed .mm-app-body .mm-sidebar-user {
        justify-content: flex-start;
        gap: .75rem;
        padding-inline: 1rem;
    }

    .mm-sidebar-collapsed .mm-app-body .mm-sidebar-user__name {
        position: static;
        width: auto;
        height: auto;
        overflow: hidden;
        clip-path: none;
    }
}
