/* ===== FONT ===== */
/* ═══════════════════════════════════════════════════════════════════════════
   BACKGROUND GRADIENTE MODERNO — main
   ═══════════════════════════════════════════════════════════════════════════ */
html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    min-height: 100vh;
    font-size: 0.9375rem;
    color: #1E334C;
    background:
        radial-gradient(
            circle at 15% 10%,
            rgba(255, 255, 255, 0.95) 0%,
            transparent 34%
        ),
        radial-gradient(
            circle at 90% 18%,
            rgba(167, 210, 255, 0.16) 0%,
            transparent 38%
        ),
        radial-gradient(
            circle at 65% 90%,
            rgba(172, 160, 255, 0.10) 0%,
            transparent 42%
        ),
        linear-gradient(
            145deg,
            #F8FAFD 0%,
            #F0F5FB 48%,
            #EAF2FB 100%
        );
}

h1, h2, h3, h4, h5, h6,
.card-title, .card-header,
.nav-link, label, th {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

/* ===== LINK ===== */
a, .btn-link {
    color: #1E334C;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTON SYSTEM UNICO (2026-08-24)
   Gerarchia: PRIMARY (pieno navy) · SECONDARY (outline) · GHOST (trasparente)
   · DANGER (outline; pieno SOLO nella conferma finale, es. ConfermaEliminazione)
   · ICON BUTTON (eco-act, in economia.css). Token qui sotto: il design dei
   pulsanti si cambia da questo punto, mai pagina per pagina.
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
    --btn-primary-bg:        #001B48;
    --btn-primary-bg-hover:  #12315F;   /* leggero aumento di luminosità */
    --btn-primary-disabled:  #A9B4C9;
    --btn-border:            #C7D2E2;   /* bordo secondary a riposo */
    --btn-ink:               #001B48;   /* testo secondary/ghost */
    --btn-ghost-hover:       #EDF3FB;
    --btn-danger:            #C0392B;
    --btn-danger-hover:      #A93226;
    --btn-radius:            10px;
    /* Icon button (azioni a sola icona): 36×36 ovunque. Anche i cloni scoped
       storici (st-/sf-/aq-icon-btn…) puntano a QUESTI token: il design degli
       icon button si cambia da qui. */
    --icobtn-size:           36px;
    --icobtn-radius:         8px;
    --icobtn-ink:            #5B7A9A;
    --icobtn-hover-bg:       #EDF3FB;
    --icobtn-hover-ink:      #001B48;
    --icobtn-danger:         #C0392B;
    --icobtn-danger-bg:      #FBEBED;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: var(--btn-radius);
    min-height: 40px;
    padding: 0.375rem 1.1rem;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: background-color 0.16s ease, border-color 0.16s ease,
                color 0.16s ease, box-shadow 0.16s ease;
}

/* La spaziatura icona/testo è il gap del flex: i margini me-*/mb-* residui
   sulle icone dentro i bottoni si azzerano per non sommarsi.
   Dimensione icona unificata: 1rem (~16px). */
.btn > i[class*="bi-"], .btn > .oi, .btn > .spinner-border, .btn > .spinner-grow {
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-bottom: 0 !important;
}

.btn > i[class*="bi-"], .btn > .oi {
    font-size: 1rem;
    line-height: 1;
}

.btn-sm {
    border-radius: 8px;
    min-height: 32px;
    padding: 0.25rem 0.85rem;
    font-size: 0.8125rem;
    gap: 6px;
}

.btn-lg {
    border-radius: 12px;
    min-height: 46px;
}

/* Extra-small: pillole d'azione compatte dentro celle dense.
   Era definito (con valori diversi) in tre scoped css: ora vive solo qui. */
.btn-xs {
    border-radius: 7px;
    min-height: 26px;
    padding: 0.125rem 0.55rem;
    font-size: 0.72rem;
    gap: 4px;
    line-height: 1.4;
}

/* ── ICON BUTTON globale: azione a sola icona (modifica, elimina, ⋮…).
   36×36, icona ~16-18px, title/tooltip OBBLIGATORIO sul markup.
   Stessa veste di .eco-act (economia.css), utilizzabile ovunque. ─────────── */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--icobtn-size);
    height: var(--icobtn-size);
    flex-shrink: 0;
    padding: 0;
    border: none;
    border-radius: var(--icobtn-radius);
    background: transparent;
    color: var(--icobtn-ink);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    transition: background .12s, color .12s;
}

.btn-icon:hover { background: var(--icobtn-hover-bg); color: var(--icobtn-hover-ink); }
.btn-icon:disabled { color: #B9C9DA; cursor: not-allowed; background: transparent; }

.btn-icon--danger { color: var(--icobtn-danger); }
.btn-icon--danger:hover { background: var(--icobtn-danger-bg); color: var(--btn-danger-hover); }

.btn:disabled, .btn.disabled {
    cursor: not-allowed;
    box-shadow: none;
}

/* Solo sui <button disabled> veri: il click è già bloccato dal browser,
   qui si riattiva il puntatore per mostrare il cursore not-allowed.
   Mai su .disabled (classe usata sui link: pointer-events:none li spegne). */
.btn:disabled { pointer-events: auto; }

/* ── PRIMARY: l'azione positiva principale della schermata (una sola) ────── */
.btn-primary {
    color: #fff;
    background-color: var(--btn-primary-bg);
    border-color: var(--btn-primary-bg);
}

.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background-color: var(--btn-primary-bg-hover);
    border-color: var(--btn-primary-bg-hover);
    color: #fff;
}

.btn-primary:disabled, .btn-primary.disabled {
    background-color: var(--btn-primary-disabled);
    border-color: var(--btn-primary-disabled);
    color: #F2F5FA;
    opacity: 1;
}

/* ── SECONDARY: azione alternativa — outline, non compete con la primary.
   btn-secondary, btn-outline-primary e btn-outline-secondary convergono
   sulla STESSA veste: il markup esistente resta valido ovunque. ─────────── */
.btn-secondary,
.btn-outline-primary,
.btn-outline-secondary {
    color: var(--btn-ink);
    background-color: #fff;
    border-color: var(--btn-border);
}

.btn-secondary:hover, .btn-secondary:focus, .btn-secondary:active,
.btn-outline-primary:hover, .btn-outline-primary:focus, .btn-outline-primary:active,
.btn-outline-secondary:hover, .btn-outline-secondary:focus, .btn-outline-secondary:active {
    color: var(--btn-ink);
    background-color: #F3F7FC;
    border-color: var(--btn-ink);
}

.btn-secondary:disabled, .btn-secondary.disabled,
.btn-outline-primary:disabled, .btn-outline-primary.disabled,
.btn-outline-secondary:disabled, .btn-outline-secondary.disabled {
    color: #9AA7BA;
    background-color: #fff;
    border-color: #DEE6F0;
    opacity: 1;
}

/* ── GHOST: azione accessoria (Annulla, Mostra dettagli…) ────────────────── */
.btn-ghost, .btn-light {
    color: #33517A;
    background-color: transparent;
    border-color: transparent;
}

.btn-ghost:hover, .btn-ghost:focus, .btn-ghost:active,
.btn-light:hover, .btn-light:focus, .btn-light:active {
    color: var(--btn-ink);
    background-color: var(--btn-ghost-hover);
    border-color: transparent;
}

.btn-link {
    color: var(--btn-ink);
    font-weight: 500;
    text-decoration: none;
}

.btn-link:hover { color: var(--btn-ink); text-decoration: underline; }

/* ── DANGER: outline di default; la variante PIENA è riservata alla
   conferma finale di un'azione distruttiva (ConfermaEliminazione). ──────── */
.btn-outline-danger {
    color: var(--btn-danger);
    background-color: #fff;
    border-color: #E7C4C0;
}

.btn-outline-danger:hover, .btn-outline-danger:focus, .btn-outline-danger:active {
    color: var(--btn-danger-hover);
    background-color: #FBEBED;
    border-color: var(--btn-danger);
}

.btn-danger {
    color: #fff;
    background-color: var(--btn-danger);
    border-color: var(--btn-danger);
}

.btn-danger:hover, .btn-danger:focus, .btn-danger:active {
    background-color: var(--btn-danger-hover);
    border-color: var(--btn-danger-hover);
    color: #fff;
}

/* ── SUCCESS / WARNING: tinte tenui esistenti, geometria del sistema ─────── */
.btn-success {
    color: #fff;
    background-color: #5F9150;
    border-color: #508040;
}

.btn-success:hover {
    background-color: #508040;
    border-color: #407030;
    color: #fff;
}

.btn-warning {
    color: #fff;
    background-color: #C89540;
    border-color: #B88430;
}

.btn-warning:hover {
    background-color: #B88430;
    border-color: #A07020;
    color: #fff;
}

/* Focus ring unificato */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus,
.form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #B7D8FF;
    outline: none;
}

/* ===== CARD ===== */
.card {
    border: 1px solid #dceaf8;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(30, 51, 76, 0.06);
}

.card-header {
    background-color: #f7fafd;
    border-bottom: 1px solid #dceaf8;
    border-radius: 12px 12px 0 0 !important;
    font-weight: 600;
    font-size: 0.875rem;
    color: #1E334C;
    padding: 14px 24px;   /* stesso asse sinistro del corpo (standard spaziatura 2026-09-04) */
}

.card-body {
    padding: 20px 24px;   /* container principali: 24px orizzontali; 16px su mobile (vedi media query in fondo alle tabelle) */
}

/* ===== FORM CONTROLS ===== */
.form-control, .form-select {
    border-color: #dceaf8;
    border-radius: 10px;
    font-size: 0.875rem;
    color: #1E334C;
}

.form-control:focus, .form-select:focus {
    border-color: #B7D8FF;
    color: #1E334C;
}

/* ===== TABELLE ===== */
.table thead th {
    color: #1E334C;
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid #dceaf8;
}

.table td {
    font-size: 0.875rem;
    vertical-align: middle;
}

/* Standard di spaziatura delle tabelle (normalizzazione UX 2026-09-04, vale per TUTTE le
   tabelle Bootstrap non compatte): header 12px/16px, righe 14px/16px, prima e ultima
   colonna 20px così checkbox, icone e testi non sono mai a filo. Le .table-sm restano
   compatte (tabelle annidate, stampe). Le .eco-table hanno le stesse misure in economia.css. */
.table:not(.table-sm) > thead > tr > th { padding: 12px 16px; vertical-align: middle; }
.table:not(.table-sm) > tbody > tr > td,
.table:not(.table-sm) > tfoot > tr > td { padding: 14px 16px; }
.table:not(.table-sm) > * > tr > th:first-child,
.table:not(.table-sm) > * > tr > td:first-child { padding-left: 20px; }
.table:not(.table-sm) > * > tr > th:last-child,
.table:not(.table-sm) > * > tr > td:last-child { padding-right: 20px; }
.table > * > tr > td.text-end,
.table > * > tr > th.text-end { white-space: nowrap; font-variant-numeric: tabular-nums; }

@media (max-width: 992px) {
    .card-header { padding: 12px 20px; }
    .card-body   { padding: 16px 20px; }
    .table:not(.table-sm) > thead > tr > th { padding: 10px 12px; }
    .table:not(.table-sm) > tbody > tr > td,
    .table:not(.table-sm) > tfoot > tr > td { padding: 12px 12px; }
    .table:not(.table-sm) > * > tr > th:first-child,
    .table:not(.table-sm) > * > tr > td:first-child { padding-left: 16px; }
    .table:not(.table-sm) > * > tr > th:last-child,
    .table:not(.table-sm) > * > tr > td:last-child { padding-right: 16px; }
}

@media (max-width: 600px) {
    .card-header { padding: 12px 16px; }
    .card-body   { padding: 16px; }
}

/* ===== SPAZIATURA CONTENUTO ===== */
.content {
    padding-top: 1.5rem;
    box-sizing: border-box;
    max-width: 100%;
    overflow-x: hidden;
}

h1:focus {
    outline: none;
}

/* ===== VALIDAZIONE ===== */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #5F9150;
}

.invalid {
    outline: 1px solid #C0614F;
}

.validation-message {
    color: #C0614F;
    font-size: 0.8125rem;
}

/* ===== BADGES ===== */
.badge {
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.35em 0.7em;
}

/* ===== BLAZOR ERROR ===== */
.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
    border-radius: 8px;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

/* ===== MODALI LEGGERE det-* (2026-08-21) =====
   Classi usate da Details.razor (Accessi QR), _IndexCME (revisioni, elimina,
   ricarica, nuova revisione, split fasi) e KbGiudizio: erano SOLO nel markup,
   mai definite in un css — le "modali" si aprivano come blocchi in linea in
   cima al contenuto (bug reale: il pannello split compariva fuori viewport,
   "il tasto % non fa nulla"). Stanno QUI perché servono a più componenti:
   il css scoped non attraversa i figli. */
.modal-backdrop-light {
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, .45);
    z-index: 1050;
}

.det-modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 6vh 16px 16px;
    z-index: 1055;
    pointer-events: none;   /* il click fuori dalla finestra arriva al backdrop, che chiude */
}

.det-modal {
    pointer-events: auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 27, 72, .25);
    width: 100%;
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.det-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #DDE5EF;
    flex-shrink: 0;
}

.det-modal-body {
    padding: 16px;
    overflow-y: auto;
}

/* ===== MISC ===== */
.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(30, 51, 76, 0.28);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

/* Spinner d2 (sostituisce lo spinner bootstrap dell'overlay LoadingService) */
.app-loading-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    padding: 16px 22px;
    border-radius: 14px;
    box-shadow: 0 18px 40px -20px rgba(30, 51, 76, .55);
    color: #5A6685;
    font-size: 14px;
    font-weight: 500;
}

.app-spinner {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    border: 3px solid #DCE3EE;
    border-top-color: #2E3C66;
    border-radius: 50%;
    animation: app-spin .8s linear infinite;
}

@keyframes app-spin {
    to { transform: rotate(360deg); }
}

/* Loader di pagina Bootstrap uniformati al look d2 (anello 2 toni).
   I piccoli .spinner-border-sm dei pulsanti restano invariati (currentColor, ok su sfondo scuro). */
.spinner-border:not(.spinner-border-sm) {
    border-width: 3px;
    border-color: #DCE3EE;
    border-top-color: #2E3C66;
    border-right-color: #DCE3EE;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LAYOUT PRINCIPALE (MainLayout)
   ═══════════════════════════════════════════════════════════════════════════ */

.page {
    position: relative;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
    background: transparent;
    overflow-x: hidden;
    min-width: 0;
}

.sidebar {
    background-color: #FFFFFF;
    border-right: 1px solid #E2E8F0;
}

.top-row {
    background-color: #ffffff;
    border-bottom: 1px solid #dceaf8;
    justify-content: flex-end;
    height: 3.5rem;
    display: flex;
    align-items: center;
}

.top-row a, .top-row .btn-link {
    white-space: nowrap;
    margin-left: 1.5rem;
    text-decoration: none;
}

.top-row a:hover, .top-row .btn-link:hover { text-decoration: underline; }

.top-row a:first-child { overflow: hidden; text-overflow: ellipsis; }

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0,0,0,.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

@media (max-width: 719.98px) {
    .top-row { justify-content: space-between; }
    .top-row a, .top-row .btn-link { margin-left: 0; }
}

@media (min-width: 720px) {
    .page { flex-direction: row; }

    .sidebar {
        width: 260px;
        height: 100vh;
        position: sticky;
        top: 0;
        flex-shrink: 0;
        overflow: hidden;
        transition: width 0.22s ease;
        will-change: width;
    }

    :root.sidebar-compact .sidebar { width: 72px; }

    /* z-index 1025 (2026-10-02): la barra in alto è sticky e quindi un livello a sé; con 1 i suoi menu a tendina
       (utente, anno, notifiche: z-index 901 DENTRO la barra) finivano sotto le barre sticky delle pagine (es. le tab
       del Profilo azienda, z-index 20). Sopra a tutto ciò che scorre (pagine ≤ 100, .sticky-top 1020), sotto alle
       finestre modali (Bootstrap 1050+). */
    .top-row {
        position: sticky;
        top: 0;
        z-index: 1025;
    }

    .top-row.auth a:first-child {
        flex: 1;
        text-align: right;
        width: 0;
    }

    .top-row, article {
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
    }

    article { padding-bottom: 2rem !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR — CSS Variables
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
    --sidebar-bg:         #ffffff;
    --sidebar-text:       #17345c;
    --sidebar-text-muted: #6f83a1;
    --sidebar-hover:      #f4f7fb;
    --sidebar-active-bg:  #edf4ff;
    --sidebar-active:     #1565d8;
    --sidebar-border:     #e4ebf3;
    --sidebar-line:       #dbe5f0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR — NavMenu
   Larghezze: estesa 260px | compatta 72px
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Header sidebar ─────────────────────────────────────────────────────────── */
.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px 0 16px;
    height: 3.5rem;
    background: #F8FAFB;
    flex-shrink: 0;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    min-width: 0;
}

.sidebar-brand:hover { color: var(--sidebar-text); text-decoration: none; }
.sidebar-brand-accent { color: #246B9A; }
.sidebar-brand-full    { display: block; }
.sidebar-brand-compact { display: none; }

/* Logo wordmark (espanso) e logomark (compatto) nella sidebar */
.sidebar-brand-img  { height: 24px; width: auto; display: block; }
.sidebar-brand-mark { height: 30px; width: auto; display: block; }

/* In compatto il logo è anche il pulsante di espansione */
.sidebar-brand-expand {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px 8px;
    border-radius: 8px;
}
.sidebar-brand-expand:hover { background: var(--sidebar-hover); }

/* ── Toggle button ─────────────────────────────────────────────────────────── */
.sidebar-toggle-btn {
    background: none;
    border: none;
    color: var(--sidebar-text-muted);
    cursor: pointer;
    padding: 7px 8px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
    min-width: 32px;
    min-height: 32px;
}

.sidebar-toggle-btn:hover { background: var(--sidebar-hover); color: var(--sidebar-text); }

/* ── Mobile hamburger ─────────────────────────────────────────────────────── */
.navbar-toggler {
    appearance: none;
    cursor: pointer;
    width: 3.25rem;
    height: 2.25rem;
    position: absolute;
    top: 0.625rem;
    right: 1rem;
    border: 1px solid var(--sidebar-border);
    border-radius: 6px;
    background:
        url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%231D2B3A' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e")
        no-repeat center/1.5rem #FFFFFF;
    transition: background-color 0.15s;
}

.navbar-toggler:checked { background-color: var(--sidebar-hover); }

/* ── Scrollable nav area ──────────────────────────────────────────────────── */
.nav-scrollable { display: none; }
.navbar-toggler:checked ~ .nav-scrollable { display: block; }

@media (min-width: 720px) {
    .navbar-toggler { display: none; }

    .nav-scrollable {
        display: block;
        height: calc(100vh - 3.5rem);
        overflow-y: auto;
        overflow-x: hidden;
        padding: 8px 0 32px;
        scrollbar-width: thin;
        scrollbar-color: var(--sidebar-border) transparent;
    }

    .nav-scrollable::-webkit-scrollbar       { width: 4px; }
    .nav-scrollable::-webkit-scrollbar-track { background: transparent; }
    .nav-scrollable::-webkit-scrollbar-thumb { background: #D0DAE5; border-radius: 2px; }
}

/* ── Section labels ────────────────────────────────────────────────────────── */
.nav-section-item { padding: 0; margin-top: 20px; }
.nav-section-item:first-of-type { margin-top: 4px; }

.nav-section-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.09em;
    color: var(--sidebar-text-muted);
    text-transform: uppercase;
    padding: 4px 18px 6px;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
}

/* ── Nav link content wrapper ─────────────────────────────────────────────── */
.nav-link-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

/* ── Nav icons ─────────────────────────────────────────────────────────────── */
.nav-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: var(--sidebar-text-muted);
    transition: color 0.13s;
}

/* ── Nav label ─────────────────────────────────────────────────────────────── */
.nav-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.2;
    text-align: left;
}

/* ── Nav chevron ───────────────────────────────────────────────────────────── */
.nav-chevron {
    flex-shrink: 0;
    color: var(--sidebar-text-muted);
    opacity: 0.45;
    transition: transform 160ms ease, opacity 0.13s;
}

.nav-group-toggle[aria-expanded="true"] .nav-chevron {
    transform: rotate(90deg);
    opacity: 0.65;
}

/* ── Nav items (direct links) ─────────────────────────────────────────────── */
.nav-item { padding: 1px 8px; }

.nav-item .nav-link {
    color: var(--sidebar-text);
    background: none;
    border: none;
    border-radius: 8px;
    min-height: 42px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    width: 100%;
    text-decoration: none;
    transition: background 0.13s, color 0.13s;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
}

.nav-item .nav-link:hover { background: var(--sidebar-hover); }
.nav-item .nav-link:hover .nav-icon { color: var(--sidebar-text); }

.nav-item a.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active);
    font-weight: 600;
}
.nav-item a.active .nav-icon { color: var(--sidebar-active); }

.nav-item .nav-link:focus-visible {
    outline: 2px solid var(--sidebar-active);
    outline-offset: -2px;
}

/* ── Group toggle ──────────────────────────────────────────────────────────── */
.nav-group-toggle {
    background: none;
    border: none;
    color: var(--sidebar-text);
    border-radius: 8px;
    min-height: 42px;
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0 10px;
    cursor: pointer;
    transition: background 0.13s, color 0.13s;
    font-family: inherit;
    font-size: 0.875rem;
}

.nav-group-toggle:hover { background: var(--sidebar-hover); }
.nav-group-toggle:hover .nav-icon { color: var(--sidebar-text); }

.nav-group-toggle[aria-expanded="true"] {
    font-weight: 600;
    color: var(--sidebar-text);
}

.nav-group-toggle:focus-visible {
    outline: 2px solid var(--sidebar-active);
    outline-offset: -2px;
}

/* ── Group wrap ────────────────────────────────────────────────────────────── */
.nav-group-wrap {
    position: relative;
    padding: 1px 8px;
}

/* Parent con figlio attivo (CSS :has) */
.nav-group-wrap:has(.nav-submenu-link.active) > .nav-group-toggle {
    font-weight: 600;
    color: var(--sidebar-text);
}
.nav-group-wrap:has(.nav-submenu-link.active) > .nav-group-toggle .nav-icon {
    color: var(--sidebar-text);
    opacity: 0.75;
}

/* ── Badge counter ─────────────────────────────────────────────────────────── */
.nav-badge {
    background: #C95245;
    color: #fff;
    font-size: 0.58rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 4px;
    line-height: 1.4;
    flex-shrink: 0;
}

/* ── Badge "Presto" ────────────────────────────────────────────────────────── */
.nav-badge-presto {
    font-size: 0.6rem;
    background: #e8eef5;
    color: var(--sidebar-text-muted);
    padding: 0.1em 0.55em;
    border-radius: 10px;
    margin-left: auto;
    flex-shrink: 0;
    font-weight: 600;
    white-space: nowrap;
}

/* ── Submenu inline ────────────────────────────────────────────────────────── */
.nav-submenu {
    position: relative;
    margin-left: 27px;
    padding: 2px 0 4px 14px;
    margin-bottom: 2px;
}

.nav-submenu::before {
    content: "";
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 1.5px;
    background: var(--sidebar-line);
    border-radius: 1px;
}

/* Titolo sezione flyout (visibile solo in modalità compatta) */
.nav-submenu-title {
    display: none;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sidebar-text-muted);
    padding: 8px 10px 6px;
    white-space: nowrap;
}

/* ── Submenu links ─────────────────────────────────────────────────────────── */
.nav-submenu-link {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 10px;
    border-radius: 7px;
    color: #4e647d;
    font-size: 0.845rem;
    font-weight: 450;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
    overflow: hidden;
    background: none;
    border: none;
    width: 100%;
    font-family: inherit;
    text-align: left;
}

.nav-submenu-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
}

.nav-submenu-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active);
    font-weight: 600;
}

.nav-submenu-link:focus-visible {
    outline: 2px solid var(--sidebar-active);
    outline-offset: -2px;
}

/* Variante "in arrivo" */
.nav-submenu-link--coming {
    opacity: 0.45;
    pointer-events: none;
    cursor: default;
}

/* Toggle annidato (Impostazioni dentro Profilo) */
.nav-submenu-toggle {
    justify-content: space-between;
}

/* ── Chevron piccolo per toggle annidato ───────────────────────────────────── */
.nav-chevron-sm {
    flex-shrink: 0;
    color: var(--sidebar-text-muted);
    opacity: 0.45;
    transition: transform 160ms ease;
}

.nav-chevron-sm.open { transform: rotate(90deg); opacity: 0.65; }

/* ── Sub-submenu (Impostazioni dentro Profilo) ─────────────────────────────── */
.nav-sub-submenu {
    padding: 0 0 2px 8px;
    border-left: 1.5px solid var(--sidebar-line);
    margin: 1px 0 1px 8px;
}

.nav-sub-submenu-link {
    display: flex;
    align-items: center;
    min-height: 33px;
    padding: 0 8px;
    border-radius: 6px;
    color: #5a7a9a;
    font-size: 0.81rem;
    font-weight: 450;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
    background: none;
    width: 100%;
}

.nav-sub-submenu-link:hover { background: var(--sidebar-hover); color: var(--sidebar-text); }

.nav-sub-submenu-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active);
    font-weight: 600;
}

/* ── Separatore interno al submenu ────────────────────────────────────────── */
.nav-submenu-sep {
    height: 1px;
    background: var(--sidebar-border);
    margin: 4px 6px;
}

/* ── Tooltip in modalità compatta (data-nav-tip) ───────────────────────────── */
:root.sidebar-compact [data-nav-tip] { position: relative; }

:root.sidebar-compact [data-nav-tip]:hover::after {
    content: attr(data-nav-tip);
    position: fixed;
    left: 80px;
    background: #1D2B3A;
    color: #fff;
    font-size: 0.775rem;
    font-weight: 500;
    white-space: nowrap;
    padding: 5px 10px;
    border-radius: 6px;
    z-index: 1300;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(23, 37, 54, 0.2);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODALITÀ COMPATTA  :root.sidebar-compact
   ═══════════════════════════════════════════════════════════════════════════ */

:root.sidebar-compact .sidebar-brand-full    { display: none; }
:root.sidebar-compact .sidebar-brand-compact { display: block; }

/* Compatto: la testata contiene solo il logo-pulsante, centrato */
:root.sidebar-compact .sidebar-top { padding: 0; justify-content: center; }

:root.sidebar-compact .nav-label        { display: none; }
:root.sidebar-compact .nav-section-item { display: none; }
:root.sidebar-compact .nav-chevron      { display: none; }
:root.sidebar-compact .nav-chevron-sm   { display: none; }
:root.sidebar-compact .nav-badge-presto { display: none; }
:root.sidebar-compact .nav-submenu-title { display: block; }

:root.sidebar-compact .nav-icon { color: var(--sidebar-text-muted); }

:root.sidebar-compact .nav-item       { padding: 1px 4px; position: relative; }
:root.sidebar-compact .nav-group-wrap { padding: 1px 4px; }

/* In compatto, il wrapper del contenuto non si espande */
:root.sidebar-compact .nav-link-content { flex: 0 0 auto; }

:root.sidebar-compact .nav-item .nav-link,
:root.sidebar-compact .nav-group-toggle {
    justify-content: center;
    padding: 0;
    min-height: 44px;
}

:root.sidebar-compact .nav-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    margin-left: 0;
    min-width: 14px;
    font-size: 0.52rem;
    padding: 1px 3px;
    line-height: 1.35;
}

/* ── Flyout laterale in compatto ─────────────────────────────────────────── */
:root.sidebar-compact .nav-submenu {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.14s ease, visibility 0s 0.14s;
    position: fixed;
    left: 72px;
    z-index: 1200;
    background: #FFFFFF;
    min-width: 214px;
    border-radius: 0 10px 10px 0;
    box-shadow: 4px 0 20px rgba(23, 37, 54, 0.10);
    padding: 6px 6px 10px;
    border: 1px solid var(--sidebar-border);
    border-left: none;
    /* reset modalità normale */
    margin-left: 0;
    margin-bottom: 0;
}

:root.sidebar-compact .nav-submenu::before { display: none; }

:root.sidebar-compact .nav-group-wrap:hover .nav-submenu {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.14s ease, visibility 0s;
}

/* Label riabilitata dentro il flyout */
:root.sidebar-compact .nav-submenu .nav-label { display: block; }

:root.sidebar-compact .nav-submenu .nav-submenu-link {
    color: #4A5568;
    min-height: 38px;
    font-size: 0.875rem;
    padding: 0 12px;
    border-radius: 7px;
}

:root.sidebar-compact .nav-submenu .nav-submenu-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
}

:root.sidebar-compact .nav-submenu .nav-submenu-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active);
    font-weight: 600;
}

:root.sidebar-compact .nav-sub-submenu {
    margin-left: 4px;
    padding-left: 6px;
}

:root.sidebar-compact .nav-sub-submenu-link {
    color: #4A5568;
    font-size: 0.845rem;
    padding: 0 10px;
}

:root.sidebar-compact .nav-sub-submenu-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active);
    font-weight: 600;
}


/* ═══════════════════════════════════════════════════════════════════════════
   BREADCRUMB UNIVERSALE — .page-bc
   Usato da tutte le pagine. Le varianti prefissate (sc-breadcrumb, sf-breadcrumb,
   ecc.) sono equivalenti e rimangono per retrocompatibilità.
   ═══════════════════════════════════════════════════════════════════════════ */

.page-bc {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    margin: 0 0 0.5rem 0;
    font-size: 0.78rem;
    color: #5B7A9A;
}

.page-bc-item + .page-bc-item::before {
    content: '›';
    margin: 0 0.4rem;
    color: #b0c4d8;
}

.page-bc-item a { color: #5B7A9A; text-decoration: none; }
.page-bc-item a:hover { color: #1E334C; text-decoration: underline; }
.page-bc-item.active { color: #1E334C; font-weight: 500; }

/* ═══════════════════════════════════════════════════════════════════════════
   NAV-TABS — override Bootstrap per stile underline uniforme
   Rende le tab coerenti con ws-tab-btn / aq-tab-btn / sf-tab-btn
   ═══════════════════════════════════════════════════════════════════════════ */

.nav-tabs {
    border-bottom: 2px solid #dceaf8;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-width: thin;
    scrollbar-color: #B7D8FF transparent;
}

.nav-tabs::-webkit-scrollbar { height: 3px; }
.nav-tabs::-webkit-scrollbar-thumb { background: #B7D8FF; border-radius: 3px; }

.nav-tabs .nav-link {
    color: #5B7A9A;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.45rem 0.85rem;
    border: none !important;
    border-bottom: 2px solid transparent !important;
    border-radius: 0 !important;
    margin-bottom: -2px;
    background: transparent !important;
    white-space: nowrap;
    transition: color 0.12s, border-color 0.12s;
}

.nav-tabs .nav-link:hover {
    color: #1E334C;
    border-bottom-color: #b5cfe8 !important;
    background: transparent !important;
}

.nav-tabs .nav-link.active,
.nav-tabs .nav-item.show .nav-link {
    color: #1E334C !important;
    font-weight: 700;
    border-bottom: 2px solid #1E334C !important;
    background: transparent !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIDE DRAWER
   ═══════════════════════════════════════════════════════════════════════════ */

.side-drawer__overlay {
    position: fixed;
    inset: 0;
    background: rgba(16, 29, 46, 0.45);
    z-index: 1040;
    animation: sd-fade-in 0.18s ease;
}

.side-drawer__panel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 66.67%;
    max-width: 900px;
    background: #fff;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 32px rgba(16, 29, 46, 0.18);
    animation: sd-slide-in 0.22s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.side-drawer__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.1rem 1.25rem 1rem;
    border-bottom: 1px solid #dceaf8;
    flex-shrink: 0;
    background: #f7fafd;
}

.side-drawer__header-text { min-width: 0; flex: 1; }

.side-drawer__title {
    font-size: 1rem;
    font-weight: 700;
    color: #1E334C;
    line-height: 1.3;
}

.side-drawer__subtitle {
    font-size: 0.8rem;
    color: #5B7A9A;
    margin-top: 0.15rem;
}

.side-drawer__close {
    background: none;
    border: none;
    color: #5B7A9A;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
    margin-left: 0.75rem;
    transition: background 0.12s, color 0.12s;
}

.side-drawer__close:hover { background: #e8f0fb; color: #1E334C; }

.side-drawer__unsaved-warn {
    background: #fff8e1;
    border-bottom: 1px solid #f0d060;
    padding: 0.75rem 1.25rem;
    font-size: 0.85rem;
    color: #7a5a00;
    flex-shrink: 0;
}

.side-drawer__body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    scrollbar-width: thin;
    scrollbar-color: #c8d8e8 transparent;
}

.side-drawer__body::-webkit-scrollbar       { width: 5px; }
.side-drawer__body::-webkit-scrollbar-track { background: transparent; }
.side-drawer__body::-webkit-scrollbar-thumb { background: #c8d8e8; border-radius: 3px; }

.side-drawer__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.25rem;
    border-top: 1px solid #dceaf8;
    background: #f7fafd;
    flex-shrink: 0;
    gap: 0.5rem;
}

@keyframes sd-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes sd-slide-in {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

@media (max-width: 768px) {
    .side-drawer__panel {
        width: 100%;
        max-width: 100%;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE ≤720px — Sizing globale per operatori di cantiere
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 719.98px) {
    html, body { font-size: 16px; }

    .form-control,
    .form-select {
        font-size: 1.0625rem;
        min-height: 48px;
    }

    label { font-size: 0.9375rem; }

    .btn { min-height: 44px; font-size: 1rem; }
    .btn-sm { min-height: 40px; font-size: 0.9375rem; }

    /* Evita scroll orizzontale */
    article, .content { overflow-x: hidden; }

    /* ── Nascondi sidebar desktop su mobile ─────────────────────────────── */
    .sidebar { display: none !important; }

    /* ── Nascondi workspace (login/profilo) nell'header desktop su mobile ── */
    .hdr-workspace-area { display: none !important; }

    /* ── Notifiche panel: adattato alla larghezza mobile ────────────────── *
       Ancorato allo schermo, non alla campanella: dal 2026-10-06 la campanella sta
       a sinistra dell'hamburger e un pannello largo quanto lo schermo, allineato a
       lei, usciva dal bordo sinistro. */
    .notif-panel {
        position: fixed !important;
        top: 64px !important;
        left: 12px !important;
        right: 12px !important;
        width: auto !important;
    }

    /* ── Padding bottom main per lasciare spazio alla bottom nav fissa ──── */
    main { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px) + 16px); }

    /* ── Ruoli di campo: nascondi l'header desktop (AppHeader) su mobile ──
       Su mobile per lavoratore/capocommessa si vede SOLO op-topbar. ───── */
    .page--field .top-row { display: none !important; }

    /* ── Amministrazione: la campanella sale nella riga del logo (2026-10-06) ──
       Su telefono dell'AppHeader resta visibile solo la campanella (workspace nascosto
       sopra): invece di una seconda fascia da 56 px sotto «Commessa.ai ☰», la barra si
       posa sopra mob-top-bar, a sinistra dell'hamburger. Stesso componente, nessun
       secondo caricamento delle notifiche. Sotto il menu laterale (z-index 1050). */
    .page:not(.page--field) .top-row {
        position: fixed;
        top: 0;
        right: 64px;
        height: 60px;
        width: auto;
        padding: 0 !important;
        background: transparent;
        border-bottom: 0;
        z-index: 310;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MainLayout — chrome operatore (op-topbar + op-bottom-nav) per i ruoli di
   campo. Renderizzata da MainLayout ma visibile SOLO su mobile (≤720px):
   su desktop questi ruoli usano sidebar + AppHeader come gli altri.
   ═══════════════════════════════════════════════════════════════════════════ */
.ml-op-chrome { display: none; }

@media (max-width: 719.98px) {
    .ml-op-chrome { display: block; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE HEADER (mob-top-bar) — visibile solo sotto 720px
   ═══════════════════════════════════════════════════════════════════════════ */

.mob-top-bar {
    display: none;
}

@media (max-width: 719.98px) {
    .mob-top-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 60px;
        padding: 0 16px;
        background: #ffffff;
        border-bottom: 1px solid #dceaf8;
        position: sticky;
        top: 0;
        z-index: 300;
        flex-shrink: 0;
        -webkit-tap-highlight-color: transparent;
    }
}

.mob-top-bar-logo {
    font-size: 1.0625rem;
    font-weight: 700;
    color: #1D2B3A;
    text-decoration: none;
    letter-spacing: 0.02em;
    line-height: 1;
}

.mob-top-bar-logo:hover { color: #1D2B3A; text-decoration: none; }

.mob-top-bar-logo-accent { color: #246B9A; }

.mob-top-bar-hamburger {
    background: none;
    border: none;
    cursor: pointer;
    color: #1D2B3A;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

.mob-top-bar-hamburger:active { background: #f0f5fb; }

/* Pagine interne (disegno di Vanessa, 2026-10-06): «‹ Titolo / sottotitolo» al posto del logo.
   padding-right: lo spazio della campanella, che si posa sopra la barra (vedi .top-row su mobile). */
.mob-top-bar-pagina {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: -10px;
    padding-right: 48px;
}

.mob-top-bar-back {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #16223A;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.mob-top-bar-back:active { background: #f0f5fb; }

.mob-top-bar-testi { min-width: 0; display: flex; flex-direction: column; }

.mob-top-bar-titolo {
    font-size: 18px;
    font-weight: 700;
    line-height: 22px;
    color: #16223A;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mob-top-bar-sotto {
    font-size: 13px;
    line-height: 18px;
    color: #4A5A72;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE DRAWER — mob-drawer-*
   Aperto da sinistra, overlay scuro, chiusura via X / click esterno
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Body lock ──────────────────────────────────────────────────────────────── */
body.mob-drawer-open {
    overflow: hidden;
}

/* ── Overlay ─────────────────────────────────────────────────────────────────── */
.mob-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(16, 29, 46, 0.52);
    z-index: 1050;
    animation: mob-overlay-fadein 0.2s ease;
}

@keyframes mob-overlay-fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Pannello ────────────────────────────────────────────────────────────────── */
.mob-drawer-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 85%;
    max-width: 340px;
    height: 100vh;
    height: 100dvh;
    background: #ffffff;
    z-index: 1060;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 40px rgba(16, 29, 46, 0.2);
    animation: mob-drawer-slidein 0.25s cubic-bezier(0.22, 0.61, 0.36, 1);
    overflow: hidden;
}

@keyframes mob-drawer-slidein {
    from { transform: translateX(-100%); }
    to   { transform: translateX(0); }
}

/* ── Header del drawer ───────────────────────────────────────────────────────── */
.mob-drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 16px 16px;
    border-bottom: 1px solid #edf2f7;
    background: #f7fafd;
    flex-shrink: 0;
    gap: 8px;
}

.mob-drawer-brand-area {
    flex: 1;
    min-width: 0;
}

.mob-drawer-logo {
    display: block;
    font-size: 1.0625rem;
    font-weight: 700;
    color: #1D2B3A;
    text-decoration: none;
    letter-spacing: 0.02em;
    line-height: 1;
    margin-bottom: 6px;
}

.mob-drawer-logo:hover { color: #1D2B3A; text-decoration: none; }
.mob-drawer-logo-accent { color: #246B9A; }

.mob-drawer-company {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #1E334C;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mob-drawer-email {
    font-size: 0.72rem;
    color: #6B7C8F;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mob-drawer-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #6B7C8F;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.12s, color 0.12s;
    -webkit-tap-highlight-color: transparent;
}

.mob-drawer-close-btn:active { background: #e8f0fb; color: #1E334C; }

/* ── Corpo scrollabile ───────────────────────────────────────────────────────── */
.mob-drawer-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 0 16px;
    scrollbar-width: thin;
    scrollbar-color: #dce8f5 transparent;
}

.mob-drawer-body::-webkit-scrollbar       { width: 3px; }
.mob-drawer-body::-webkit-scrollbar-track { background: transparent; }
.mob-drawer-body::-webkit-scrollbar-thumb { background: #dce8f5; border-radius: 2px; }

/* ── Etichetta sezione ───────────────────────────────────────────────────────── */
.mob-drawer-section-label {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #B0BCCA;
    text-transform: uppercase;
    padding: 14px 20px 4px;
    pointer-events: none;
}

/* ── Voce di menu di primo livello ──────────────────────────────────────────── */
.mob-drawer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px 0 20px;
    height: 48px;
    min-height: 48px;
    color: #2D4059;
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1;
    transition: background 0.12s;
    -webkit-tap-highlight-color: transparent;
    border: none;
    background: none;
    width: 100%;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
}

.mob-drawer-item:active,
.mob-drawer-item:hover {
    background: #f0f5fb;
    color: #1E334C;
    text-decoration: none;
}

.mob-drawer-item.active {
    background: #EAF2FF;
    color: #246B9A;
    font-weight: 600;
    text-decoration: none;
}

/* ── Gruppo con accordion ────────────────────────────────────────────────────── */
.mob-drawer-group { }

.mob-drawer-group-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px 0 20px;
    height: 48px;
    min-height: 48px;
    color: #2D4059;
    font-size: 0.9375rem;
    font-weight: 500;
    background: none;
    border: none;
    width: 100%;
    cursor: pointer;
    transition: background 0.12s;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
    text-align: left;
}

.mob-drawer-group-toggle:active { background: #f0f5fb; }

.mob-drawer-chevron {
    margin-left: auto;
    font-size: 0.55rem;
    color: #9BAABB;
    transition: transform 0.2s ease;
    display: inline-block;
    line-height: 1;
    flex-shrink: 0;
}

.mob-drawer-chevron.open { transform: rotate(180deg); }

/* ── Badge numerico ──────────────────────────────────────────────────────────── */
.mob-drawer-badge {
    background: #C95245;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 4px;
    line-height: 1.4;
    flex-shrink: 0;
}

/* ── Sottomenu ───────────────────────────────────────────────────────────────── */
.mob-drawer-submenu {
    padding: 4px 0 8px 52px;
    background: #fafcfe;
    border-bottom: 1px solid #f0f5fb;
}

.mob-drawer-subitem {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px 0 0;
    height: 44px;
    min-height: 44px;
    color: #5B7A9A;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 400;
    transition: background 0.1s;
    -webkit-tap-highlight-color: transparent;
    width: 100%;
    font-family: inherit;
}

.mob-drawer-subitem:active,
.mob-drawer-subitem:hover {
    color: #1E334C;
    text-decoration: none;
}

.mob-drawer-subitem.active {
    color: #246B9A;
    font-weight: 600;
    text-decoration: none;
}

/* ── Footer: Profilo + Logout ───────────────────────────────────────────────── */
.mob-drawer-footer {
    display: flex;
    flex-direction: column;
    border-top: 1px solid #edf2f7;
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px));
    flex-shrink: 0;
    background: #f7fafd;
}

.mob-drawer-footer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px 0 20px;
    height: 48px;
    min-height: 48px;
    color: #2D4059;
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: background 0.12s;
    -webkit-tap-highlight-color: transparent;
    border: none;
    background: none;
    width: 100%;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
}

.mob-drawer-footer-item:active,
.mob-drawer-footer-item:hover {
    background: #f0f5fb;
    color: #1E334C;
    text-decoration: none;
}

.mob-drawer-footer-item.active {
    background: #EAF2FF;
    color: #246B9A;
    font-weight: 600;
}

.mob-drawer-footer-item--logout {
    color: #C0614F !important;
}

.mob-drawer-footer-item--logout:active,
.mob-drawer-footer-item--logout:hover {
    background: #fff5f4 !important;
    color: #A0513F !important;
    text-decoration: none;
}
