/*
 * Tema base (template) — estetica SB Admin 2 (MIT, Start Bootstrap) portata su Bootstrap 5.3.
 * Il template originale è Bootstrap 4 + jQuery: qui ne riprendiamo palette, tipografia
 * e layout riscrivendoli sulle variabili CSS di Bootstrap 5, senza jQuery.
 */

/* ---------------------------------------------------------------
   1. Palette e variabili globali
   --------------------------------------------------------------- */

:root,
[data-bs-theme="light"] {
    /* Grigi SB Admin 2 */
    --tpl-gray-100: #f8f9fc;
    --tpl-gray-200: #eaecf4;
    --tpl-gray-300: #dddfeb;
    --tpl-gray-400: #d1d3e2;
    --tpl-gray-500: #b7b9cc;
    --tpl-gray-600: #858796;
    --tpl-gray-700: #6e707e;
    --tpl-gray-800: #5a5c69;
    --tpl-gray-900: #3a3b45;

    /* Misure di layout */
    --tpl-sidebar-width: 15rem;
    --tpl-sidebar-collapsed-width: 4.75rem;
    --tpl-topbar-height: 3.25rem;

    /* Shell scura (sidebar + topbar) */
    --shell-bg: #1f2124;
    --shell-hover: rgba(255, 255, 255, 0.05);
    --shell-border: rgba(255, 255, 255, 0.07);
    --shell-text: #e8eaed;
    --shell-muted: #8a9099;
    --shell-accent: #16a34a;
    --shell-accent-hover: #15803d;
    --shell-accent-soft: rgba(22, 163, 74, 0.15);
    --shell-accent-text: #4ade80;

    /* Override dei colori tematici di Bootstrap */
    --bs-primary: #4e73df;
    --bs-primary-rgb: 78, 115, 223;
    --bs-secondary: #858796;
    --bs-secondary-rgb: 133, 135, 150;
    --bs-success: #1cc88a;
    --bs-success-rgb: 28, 200, 138;
    --bs-info: #36b9cc;
    --bs-info-rgb: 54, 185, 204;
    --bs-warning: #f6c23e;
    --bs-warning-rgb: 246, 194, 62;
    --bs-danger: #e74a3b;
    --bs-danger-rgb: 231, 74, 59;
    --bs-light: #f8f9fc;
    --bs-light-rgb: 248, 249, 252;
    --bs-dark: #5a5c69;
    --bs-dark-rgb: 90, 92, 105;

    --bs-body-font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-body-color: #858796;
    --bs-body-color-rgb: 133, 135, 150;
    --bs-body-bg: #f8f9fc;
    --bs-heading-color: #5a5c69;

    --bs-border-color: #e3e6f0;
    --bs-border-radius: 0.35rem;

    --bs-link-color: #4e73df;
    --bs-link-color-rgb: 78, 115, 223;
    --bs-link-hover-color: #224abe;
    --bs-link-hover-color-rgb: 34, 74, 190;

    --bs-emphasis-color: #5a5c69;
}

/* Le ombre del template sono più morbide e diffuse di quelle di Bootstrap. */
.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem 0 rgba(58, 59, 69, 0.2) !important;
}

.shadow {
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15) !important;
}

.shadow-lg {
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175) !important;
}

/* ---------------------------------------------------------------
   2. Bottoni
   In Bootstrap 5 i colori dei bottoni sono cotti nelle regole .btn-*,
   non derivati da --bs-primary: vanno rimappati uno per uno.
   --------------------------------------------------------------- */

.btn-primary {
    --bs-btn-bg: #4e73df;
    --bs-btn-border-color: #4e73df;
    --bs-btn-hover-bg: #2e59d9;
    --bs-btn-hover-border-color: #2653d4;
    --bs-btn-active-bg: #2653d4;
    --bs-btn-active-border-color: #244ec9;
    --bs-btn-disabled-bg: #4e73df;
    --bs-btn-disabled-border-color: #4e73df;
    --bs-btn-focus-shadow-rgb: 105, 136, 228;
}

.btn-secondary {
    --bs-btn-bg: #858796;
    --bs-btn-border-color: #858796;
    --bs-btn-hover-bg: #717384;
    --bs-btn-hover-border-color: #6b6d7d;
    --bs-btn-active-bg: #6b6d7d;
    --bs-btn-active-border-color: #656776;
    --bs-btn-disabled-bg: #858796;
    --bs-btn-disabled-border-color: #858796;
    --bs-btn-focus-shadow-rgb: 151, 153, 166;
}

.btn-success {
    --bs-btn-bg: #1cc88a;
    --bs-btn-border-color: #1cc88a;
    --bs-btn-hover-bg: #17a673;
    --bs-btn-hover-border-color: #169b6b;
    --bs-btn-active-bg: #169b6b;
    --bs-btn-active-border-color: #149063;
    --bs-btn-disabled-bg: #1cc88a;
    --bs-btn-disabled-border-color: #1cc88a;
    --bs-btn-focus-shadow-rgb: 62, 208, 156;
}

.btn-info {
    --bs-btn-bg: #36b9cc;
    --bs-btn-border-color: #36b9cc;
    --bs-btn-hover-bg: #2c9faf;
    --bs-btn-hover-border-color: #2a96a5;
    --bs-btn-active-bg: #2a96a5;
    --bs-btn-active-border-color: #278d9b;
    --bs-btn-disabled-bg: #36b9cc;
    --bs-btn-disabled-border-color: #36b9cc;
    --bs-btn-focus-shadow-rgb: 84, 196, 212;
}

/* Il template usa una soglia di contrasto alta: il giallo tiene testo bianco. */
.btn-warning {
    --bs-btn-color: #fff;
    --bs-btn-bg: #f6c23e;
    --bs-btn-border-color: #f6c23e;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #f4b619;
    --bs-btn-hover-border-color: #f4b30d;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #f4b30d;
    --bs-btn-active-border-color: #eaa908;
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: #f6c23e;
    --bs-btn-disabled-border-color: #f6c23e;
    --bs-btn-focus-shadow-rgb: 247, 202, 91;
}

.btn-danger {
    --bs-btn-bg: #e74a3b;
    --bs-btn-border-color: #e74a3b;
    --bs-btn-hover-bg: #e02d1b;
    --bs-btn-hover-border-color: #d52a1a;
    --bs-btn-active-bg: #d52a1a;
    --bs-btn-active-border-color: #ca2818;
    --bs-btn-disabled-bg: #e74a3b;
    --bs-btn-disabled-border-color: #e74a3b;
    --bs-btn-focus-shadow-rgb: 235, 101, 88;
}

.btn-light {
    --bs-btn-bg: #f8f9fc;
    --bs-btn-border-color: #f8f9fc;
    --bs-btn-hover-bg: #dfe3f3;
    --bs-btn-hover-border-color: #d4daf0;
    --bs-btn-active-bg: #d4daf0;
    --bs-btn-active-border-color: #c9d1ec;
}

.btn-dark {
    --bs-btn-bg: #5a5c69;
    --bs-btn-border-color: #5a5c69;
    --bs-btn-hover-bg: #484a54;
    --bs-btn-hover-border-color: #42444e;
    --bs-btn-active-bg: #42444e;
    --bs-btn-active-border-color: #3d3e47;
}

.btn-outline-primary {
    --bs-btn-color: #4e73df;
    --bs-btn-border-color: #4e73df;
    --bs-btn-hover-bg: #4e73df;
    --bs-btn-hover-border-color: #4e73df;
    --bs-btn-active-bg: #4e73df;
    --bs-btn-active-border-color: #4e73df;
    --bs-btn-disabled-color: #4e73df;
    --bs-btn-disabled-border-color: #4e73df;
}

.btn-circle {
    border-radius: 100%;
    height: 2.5rem;
    width: 2.5rem;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.btn-circle.btn-sm {
    height: 1.8rem;
    width: 1.8rem;
    font-size: 0.75rem;
}

.btn-icon-split {
    padding: 0;
    overflow: hidden;
    display: inline-flex;
    align-items: stretch;
    justify-content: center;
}

.btn-icon-split .icon {
    background: rgba(0, 0, 0, 0.15);
    display: inline-block;
    padding: 0.375rem 0.75rem;
}

.btn-icon-split .text {
    display: inline-block;
    padding: 0.375rem 0.75rem;
}

/* ---------------------------------------------------------------
   3. Layout: wrapper, sidebar, topbar
   --------------------------------------------------------------- */

html {
    position: relative;
    min-height: 100%;
}

body {
    min-height: 100vh;
}

#wrapper {
    display: flex;
    min-height: 100vh;
}

#content-wrapper {
    background-color: var(--tpl-gray-100);
    width: 100%;
    min-width: 0;
    /* clip e non hidden: hidden crea un contenitore di scroll e la topbar sticky smetterebbe di funzionare. */
    overflow-x: clip;
    display: flex;
    flex-direction: column;
}

#content {
    flex: 1 0 auto;
}

/* --- Sidebar --- */

.sidebar {
    width: var(--tpl-sidebar-width);
    flex: 0 0 var(--tpl-sidebar-width);
    align-self: flex-start;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--shell-bg);
    border-right: 1px solid var(--shell-border);
    color: var(--shell-text);
    z-index: 1030;
    transition: flex-basis 0.15s ease-in-out, width 0.15s ease-in-out;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: var(--tpl-topbar-height);
    padding: 0 0.75rem 0 1rem;
    border-bottom: 1px solid var(--shell-border);
    flex-shrink: 0;
}

.sidebar-brand-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex: 1;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

.sidebar-brand-link:hover {
    color: inherit;
}

/* Pastiglia chiara: il logo è blu scuro e sul fondo della shell sparirebbe. */
.sidebar-brand-logo {
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
    object-fit: contain;
    background-color: #fff;
    border-radius: 0.55rem;
    padding: 0.15rem;
}

.sidebar-brand-text {
    min-width: 0;
    line-height: 1.2;
}

.sidebar-brand-name {
    display: block;
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: #fff;
    white-space: nowrap;
}

.sidebar-brand-sub {
    display: block;
    font-size: 0.7rem;
    color: var(--shell-accent-text);
    white-space: nowrap;
}

.sidebar-collapse-btn {
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--shell-muted);
}

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

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0.5rem;
}

.sidebar-section + .sidebar-section {
    margin-top: 1rem;
}

.sidebar-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.5rem 0.4rem;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--shell-muted);
}

.sidebar-heading-note {
    font-family: var(--bs-font-monospace);
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
}

.sidebar-heading-note.is-accent {
    font-family: inherit;
    font-weight: 600;
    color: var(--shell-accent-text);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.65rem;
    margin-bottom: 0.15rem;
    border-radius: 0.6rem;
    line-height: 1.2;
    color: var(--shell-text);
    text-decoration: none;
}

.sidebar-link:hover {
    background-color: var(--shell-hover);
    color: #fff;
}

.sidebar-link.active {
    background-color: var(--shell-accent);
    color: #fff;
}

.sidebar-link.is-disabled {
    opacity: 0.35;
    cursor: default;
}

.sidebar-link.is-disabled:hover {
    background-color: transparent;
}

.sidebar-link-icon {
    width: 1.25rem;
    flex-shrink: 0;
    text-align: center;
    font-size: 0.95rem;
    color: var(--shell-muted);
}

.sidebar-link:hover .sidebar-link-icon,
.sidebar-link.active .sidebar-link-icon {
    color: #fff;
}

.sidebar-link-text {
    flex: 1;
    min-width: 0;
}

.sidebar-link-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.84rem;
    font-weight: 600;
    white-space: nowrap;
}

.sidebar-link-sub {
    display: block;
    font-size: 0.7rem;
    color: var(--shell-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-link.active .sidebar-link-sub {
    color: rgba(255, 255, 255, 0.85);
}

.sidebar-badge-ai {
    padding: 0.05rem 0.3rem;
    font-size: 0.58rem;
    font-weight: 700;
    border: 1px solid rgba(74, 222, 128, 0.45);
    border-radius: 0.3rem;
    background-color: var(--shell-accent-soft);
    color: var(--shell-accent-text);
}

.sidebar-link.active .sidebar-badge-ai {
    border-color: rgba(255, 255, 255, 0.6);
    background-color: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.sidebar-tag {
    flex-shrink: 0;
    padding: 0.1rem 0.4rem;
    font-size: 0.62rem;
    border: 1px solid var(--shell-border);
    border-radius: 0.3rem;
    background-color: rgba(255, 255, 255, 0.06);
    color: var(--shell-muted);
}

.sidebar-chevron {
    font-size: 0.7rem;
    color: var(--shell-muted);
    transition: transform 0.15s ease;
}

/* Sottomenu (<details>): la voce apre e chiude, i figli sono link rientrati. */
.sidebar-gruppo > summary {
    list-style: none;
    cursor: pointer;
}

.sidebar-gruppo > summary::-webkit-details-marker {
    display: none;
}

.sidebar-gruppo[open] > summary .sidebar-chevron {
    transform: rotate(90deg);
}

/* Si è su una pagina del gruppo: evidenza leggera, il verde pieno resta alla pagina aperta. */
.sidebar-gruppo > summary.is-current {
    background-color: var(--shell-hover);
    color: #fff;
}

.sidebar-gruppo > summary.is-current .sidebar-link-icon {
    color: #fff;
}

.sidebar-sottomenu {
    margin: 0.1rem 0 0.35rem 1.25rem;
    padding-left: 0.6rem;
    border-left: 1px solid var(--shell-border);
}

.sidebar-sotto-link {
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
}

.sidebar-sotto-link .sidebar-link-title {
    font-size: 0.8rem;
    font-weight: 500;
}

.sidebar-sotto-link .sidebar-link-icon {
    font-size: 0.8rem;
}

.sidebar-user {
    flex-shrink: 0;
    padding: 0.75rem;
    border-top: 1px solid var(--shell-border);
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--shell-border);
    border-radius: 0.75rem;
    background-color: rgba(255, 255, 255, 0.04);
    color: var(--shell-text);
    text-decoration: none;
}

.sidebar-user-card:hover {
    background-color: var(--shell-hover);
    color: #fff;
}

.sidebar-user-text {
    min-width: 0;
    line-height: 1.25;
}

.sidebar-user-name {
    display: block;
    font-size: 0.84rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-sub {
    display: block;
    font-size: 0.7rem;
    color: var(--shell-accent-text);
}

.sidebar-user-sub i {
    font-size: 0.45rem;
    vertical-align: middle;
    margin-right: 0.2rem;
}

/* Anello verde attorno all'avatar (foto o iniziali). */
.shell-avatar {
    display: inline-flex;
    flex-shrink: 0;
}

.shell-avatar .avatar {
    box-shadow: 0 0 0 2px var(--shell-bg), 0 0 0 3px var(--shell-accent);
}

/* --- Stato collassato ---
   La classe vive su <html>: fuori dall'albero che Blazor rigenera,
   così il collasso sopravvive alla navigazione. */

.sidebar-collapsed .sidebar {
    width: var(--tpl-sidebar-collapsed-width);
    flex-basis: var(--tpl-sidebar-collapsed-width);
}

.sidebar-collapsed .sidebar .sidebar-brand {
    justify-content: center;
    padding: 0;
}

.sidebar-collapsed .sidebar .sidebar-brand-link {
    flex: 0 0 auto;
}

.sidebar-collapsed .sidebar .sidebar-brand-text,
.sidebar-collapsed .sidebar .sidebar-collapse-btn,
.sidebar-collapsed .sidebar .sidebar-heading,
.sidebar-collapsed .sidebar .sidebar-link-text,
.sidebar-collapsed .sidebar .sidebar-tag,
.sidebar-collapsed .sidebar .sidebar-chevron,
.sidebar-collapsed .sidebar .sidebar-user-text {
    display: none;
}

/* Sidebar ridotta: i figli restano come icone, senza rientro. */
.sidebar-collapsed .sidebar .sidebar-sottomenu {
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
}

.sidebar-collapsed .sidebar .sidebar-link,
.sidebar-collapsed .sidebar .sidebar-user-card {
    justify-content: center;
}

.sidebar-collapsed .sidebar .sidebar-section + .sidebar-section {
    padding-top: 0.75rem;
    border-top: 1px solid var(--shell-border);
}

/* Sotto i 768px la sidebar è sempre ridotta a icone. */
@media (max-width: 767.98px) {
    .sidebar {
        width: var(--tpl-sidebar-collapsed-width);
        flex-basis: var(--tpl-sidebar-collapsed-width);
    }

    .sidebar .sidebar-brand {
        justify-content: center;
        padding: 0;
    }

    .sidebar .sidebar-brand-link {
        flex: 0 0 auto;
    }

    .sidebar .sidebar-brand-text,
    .sidebar .sidebar-collapse-btn,
    .sidebar .sidebar-heading,
    .sidebar .sidebar-link-text,
    .sidebar .sidebar-tag,
    .sidebar .sidebar-chevron,
    .sidebar .sidebar-user-text {
        display: none;
    }

    .sidebar .sidebar-link,
    .sidebar .sidebar-user-card {
        justify-content: center;
    }

    .sidebar .sidebar-sottomenu {
        margin-left: 0;
        padding-left: 0;
        border-left: 0;
    }

    .sidebar .sidebar-section + .sidebar-section {
        padding-top: 0.75rem;
        border-top: 1px solid var(--shell-border);
    }
}

/* --- Topbar --- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    height: var(--tpl-topbar-height);
    padding: 0 1.25rem 0 0.75rem;
    background-color: var(--shell-bg);
    border-bottom: 1px solid var(--shell-border);
    color: var(--shell-text);
}

.topbar-icon-btn {
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--shell-muted);
}

.topbar-icon-btn:hover {
    background-color: var(--shell-hover);
    color: var(--shell-text);
}

.topbar-title {
    min-width: 0;
    line-height: 1.25;
}

.topbar-title h1 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-title p {
    margin: 0;
    font-size: 0.72rem;
    color: var(--shell-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-end {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
    margin-left: auto;
}

.topbar-search {
    position: relative;
    width: 20rem;
}

.topbar-search i {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
    color: var(--shell-muted);
}

.topbar-search input {
    width: 100%;
    padding: 0.45rem 0.75rem 0.45rem 2.2rem;
    font-size: 0.82rem;
    border: 1px solid var(--shell-border);
    border-radius: 0.55rem;
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--shell-text);
}

.topbar-search input::placeholder {
    color: var(--shell-muted);
}

.topbar-search input:focus {
    outline: none;
    border-color: rgba(74, 222, 128, 0.5);
    background-color: rgba(255, 255, 255, 0.08);
}

.topbar-action {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.42rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    border: 0;
    border-radius: 0.55rem;
    background-color: var(--shell-accent);
    color: #fff;
    text-decoration: none;
}

.topbar-action:hover,
.topbar-action:focus,
.topbar-action.show {
    background-color: var(--shell-accent-hover);
    color: #fff;
}

.topbar-action-caret {
    font-size: 0.65rem;
}

.topbar-divider {
    width: 1px;
    height: 1.75rem;
    flex-shrink: 0;
    background-color: var(--shell-border);
}

.topbar-user {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.25rem 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    border: 0;
    border-radius: 0.6rem;
    background: transparent;
    color: var(--shell-text);
}

.topbar-user:hover {
    background-color: var(--shell-hover);
}

/* Con la sidebar aperta lo spazio si esaurisce presto: si cede prima la ricerca, poi le etichette. */
@media (max-width: 1199.98px) {
    .topbar-search {
        display: none;
    }
}

@media (max-width: 991.98px) {
    .topbar-title p,
    .topbar-action-label,
    .topbar-user-name {
        display: none;
    }
}

@media (max-width: 767.98px) {
    .topbar-toggle,
    .topbar-divider {
        display: none;
    }
}

/* ---------------------------------------------------------------
   4. Card e intestazioni di pagina
   --------------------------------------------------------------- */

.card {
    border: 1px solid var(--bs-border-color);
}

.card .card-header {
    background-color: var(--tpl-gray-100);
    border-bottom: 1px solid var(--bs-border-color);
    padding: 0.75rem 1.25rem;
}

.card .card-header h6 {
    margin: 0;
}

/* Titolo e sottotitolo di un modulo/sezione (es. "Informazioni Personali" nel profilo). */
.titlemodulo {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
}

.subtitlemodulo {
    margin: 0.15rem 0 0;
    font-size: 0.82rem;
    color: #64748b;
}

/* Etichetta sopra un campo dei moduli. */
.labelmodulo {
    font-size: 0.82rem;
    color: #1e293b;
    font-weight: bold;
}
.textboxError
{
    margin: 0.15rem 0 0;
    font-size: 0.82rem;
    color: #b32121;
}

/* Campo di testo dei moduli; con readonly diventa grigio (sola lettura). */
.textboxmodulo {
    width: 100%;
    padding: 0.2rem 0.4rem;
    font-size: 0.92rem;
    border: 1px solid #d5dbe3;
    border-radius: 0.6rem;
    background-color: #fff;
    color: #1e293b;
}
 

.textboxmodulo[readonly] {
    background-color: #f8fafc;
    color: #334155;
}

.textboxmodulo:focus {
    outline: none;
}

.textboxmodulo:not([readonly]):focus {
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

.textboxmodulo:disabled {
    background-color: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}

/* Combo (select con form-select): spazio a destra per la freccia. */
.textboxmodulo.form-select {
    padding-right: 2.25rem;
}

/* In un input-group (es. CampoPassword con l'occhio) il campo lascia posto al pulsante,
   che prende bordo e arrotondamento del campo. */
.input-group > .textboxmodulo {
    flex: 1 1 auto;
    width: 1%;
    min-width: 0;
}

.input-group:has(> .textboxmodulo) > .btn {
    border-color: #d5dbe3;
    border-top-right-radius: 0.6rem;
    border-bottom-right-radius: 0.6rem;
    background-color: #fff;
    color: #64748b;
}

.input-group:has(> .textboxmodulo) > .btn:hover {
    background-color: #f8fafc;
    color: #0f172a;
}

/* Card statistica del cruscotto: bordo colorato a sinistra. */
.border-left-primary {
    border-left: 0.25rem solid var(--bs-primary) !important;
}

.border-left-secondary {
    border-left: 0.25rem solid var(--bs-secondary) !important;
}

.border-left-success {
    border-left: 0.25rem solid var(--bs-success) !important;
}

.border-left-info {
    border-left: 0.25rem solid var(--bs-info) !important;
}

.border-left-warning {
    border-left: 0.25rem solid var(--bs-warning) !important;
}

.border-left-danger {
    border-left: 0.25rem solid var(--bs-danger) !important;
}

.border-bottom-primary {
    border-bottom: 0.25rem solid var(--bs-primary) !important;
}

/* ---------------------------------------------------------------
   5. Utility del template
   --------------------------------------------------------------- */

.bg-gradient-primary {
    background-color: #4e73df;
    background-image: linear-gradient(180deg, #4e73df 10%, #224abe 100%);
    background-size: cover;
}

.bg-gradient-secondary {
    background-color: #858796;
    background-image: linear-gradient(180deg, #858796 10%, #60616f 100%);
    background-size: cover;
}

.bg-gradient-success {
    background-color: #1cc88a;
    background-image: linear-gradient(180deg, #1cc88a 10%, #13855c 100%);
    background-size: cover;
}

.bg-gradient-info {
    background-color: #36b9cc;
    background-image: linear-gradient(180deg, #36b9cc 10%, #258391 100%);
    background-size: cover;
}

.bg-gradient-warning {
    background-color: #f6c23e;
    background-image: linear-gradient(180deg, #f6c23e 10%, #dda20a 100%);
    background-size: cover;
}

.bg-gradient-danger {
    background-color: #e74a3b;
    background-image: linear-gradient(180deg, #e74a3b 10%, #be2617 100%);
    background-size: cover;
}

.bg-gradient-dark {
    background-color: #5a5c69;
    background-image: linear-gradient(180deg, #5a5c69 10%, #373840 100%);
    background-size: cover;
}

.bg-gray-100 { background-color: var(--tpl-gray-100) !important; }
.bg-gray-200 { background-color: var(--tpl-gray-200) !important; }
.bg-gray-300 { background-color: var(--tpl-gray-300) !important; }
.bg-gray-800 { background-color: var(--tpl-gray-800) !important; }
.bg-gray-900 { background-color: var(--tpl-gray-900) !important; }

.text-gray-100 { color: var(--tpl-gray-100) !important; }
.text-gray-200 { color: var(--tpl-gray-200) !important; }
.text-gray-300 { color: var(--tpl-gray-300) !important; }
.text-gray-400 { color: var(--tpl-gray-400) !important; }
.text-gray-500 { color: var(--tpl-gray-500) !important; }
.text-gray-600 { color: var(--tpl-gray-600) !important; }
.text-gray-700 { color: var(--tpl-gray-700) !important; }
.text-gray-800 { color: var(--tpl-gray-800) !important; }
.text-gray-900 { color: var(--tpl-gray-900) !important; }

.text-xs { font-size: 0.7rem; }
.text-lg { font-size: 1.2rem; }

.icon-circle {
    height: 2.5rem;
    width: 2.5rem;
    border-radius: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.o-hidden { overflow: hidden !important; }

/* ---------------------------------------------------------------
   5-bis. Campi dei form
   Bootstrap eredita lo sfondo dei campi da --bs-body-bg, che qui è
   il grigio chiaro di SB Admin 2: sui form si preferisce il bianco,
   che stacca di più dalle card. Non si tocca la variabile perché
   governa anche lo sfondo di pagine e card.
   --------------------------------------------------------------- */

.form-control,
.form-select {
    background-color: #fff;
}

.form-control:focus,
.form-select:focus {
    background-color: #fff;
}

.form-control:disabled,
.form-control[readonly],
.form-select:disabled {
    background-color: var(--tpl-gray-100);
}

/* ---------------------------------------------------------------
   6. Pagine di autenticazione
   --------------------------------------------------------------- */

/* --- Selettore di colore --- */

.selettore-colore-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.selettore-colore .campione {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.35rem;
    border: 1px solid rgba(0, 0, 0, 0.12);
    padding: 0;
    cursor: pointer;
    transition: transform 0.1s ease-in-out;
}

.selettore-colore .campione:hover {
    transform: scale(1.12);
}

/* Il campione scelto si riconosce da un anello esterno, che resta
   visibile su qualunque colore di sfondo. */
.selettore-colore .campione-scelto {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--bs-primary);
}

.selettore-colore .campione-vuoto {
    background-color: #fff;
    color: var(--tpl-gray-400);
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.selettore-colore input[type="color"] {
    width: 3rem;
    padding: 0.15rem;
    cursor: pointer;
}

/* Campione di colore della zona, accanto al codice esadecimale. */
.pastiglia-colore {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border-radius: 0.25rem;
    border: 1px solid var(--bs-border-color);
    vertical-align: -0.2rem;
    margin-right: 0.4rem;
}

/* Logo esteso: si adatta al contenitore senza deformarsi né sgranare. */
.logo-esteso {
    width: 100%;
    max-width: 17rem;
    height: auto;
}

.bg-login-image,
.bg-register-image,
.bg-password-image {
    background-position: center;
    background-size: cover;
    background-color: var(--tpl-gray-200);
}

.form-control-user {
    border-radius: 10rem;
    padding: 1.5rem 1rem;
    font-size: 0.8rem;
}

.btn-user {
    font-size: 0.8rem;
    border-radius: 10rem;
    padding: 0.75rem 1rem;
}

/* Campo password con pulsante "occhio": il gruppo mantiene gli angoli
   arrotondati anche quando l'input è a pillola (form-control-user). */
.input-group > .form-control-user:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group > .form-control-user {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.input-group [data-password-toggle] {
    border-top-right-radius: 10rem;
    border-bottom-right-radius: 10rem;
}

.input-group:has(.form-control-user) [data-password-toggle] {
    padding-left: 1rem;
    padding-right: 1rem;
}

/* ---------------------------------------------------------------
   6-bis. Griglia Syncfusion
   Il tema bootstrap5.3 di Syncfusion è già vicino: qui si allinea
   ai grigi e alla tipografia di SB Admin 2, senza riscriverlo.
   --------------------------------------------------------------- */

.e-grid {
    border: 0;
    font-family: var(--bs-body-font-family);
    color: var(--tpl-gray-700);
}

/* Intestazioni: minuscole, spaziate, come i titoli delle card del tema. */
.e-grid .e-gridheader {
    border-top: 0;
    border-bottom: 1px solid var(--bs-border-color);
    background-color: var(--tpl-gray-100);
}

.e-grid .e-headercell,
.e-grid .e-detailheadercell {
    background-color: var(--tpl-gray-100);
    padding: 0.75rem 1rem;
}

.e-grid .e-headercelldiv {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.02rem;
    text-transform: uppercase;
    color: var(--tpl-gray-500);
    /* L'uppercase spaziato mandava a capo "Matricola" e "Prov.": qui
       l'intestazione resta su una riga e la colonna si allarga se serve. */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.e-grid .e-rowcell {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border-color: var(--bs-border-color);
}

.e-grid .e-row:hover .e-rowcell {
    background-color: var(--tpl-gray-100);
}

.e-grid .e-altrow {
    background-color: #fcfcfe;
}

/* La riga selezionata resta leggibile: velo del primario, non blocco pieno. */
.e-grid td.e-selectionbackground,
.e-grid .e-row.e-selectionbackground .e-rowcell {
    background-color: rgba(78, 115, 223, 0.08);
    color: var(--tpl-gray-800);
}

/* Toolbar senza cornice: vive già dentro una card. */
.e-grid .e-toolbar {
    border: 0;
    border-bottom: 1px solid var(--bs-border-color);
    background-color: transparent;
    padding-left: 0;
}

.e-grid .e-toolbar .e-toolbar-item .e-tbar-btn {
    background: transparent;
    border-radius: var(--bs-border-radius);
}

.e-grid .e-toolbar .e-toolbar-item .e-tbar-btn:hover {
    background-color: var(--tpl-gray-200);
}

.e-grid .e-toolbar .e-tbar-btn-text {
    font-size: 0.8rem;
    color: var(--tpl-gray-700);
}

/* Area di trascinamento del raggruppamento: tratteggio leggero,
   deve leggersi come zona di lavoro e non come blocco pieno. */
.e-grid .e-groupdroparea {
    background-color: var(--tpl-gray-100);
    border: 1px dashed var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    color: var(--tpl-gray-500);
    font-size: 0.8rem;
    padding: 0.6rem 1rem;
    margin-bottom: 0.25rem;
}

.e-grid .e-groupdroparea.e-grouped {
    border-style: solid;
    background-color: #fff;
}

.e-grid .e-groupheadercell {
    background-color: var(--bs-primary);
    border: 0;
    border-radius: 10rem;
    color: #fff;
    padding: 0.15rem 0.5rem 0.15rem 0.85rem;
}

.e-grid .e-groupheadercell .e-headertext,
.e-grid .e-groupheadercell .e-groupsort,
.e-grid .e-groupheadercell .e-ungroupbutton {
    color: #fff;
}

.e-grid .e-groupcaption,
.e-grid .e-groupcaptionrow .e-rowcell {
    background-color: var(--tpl-gray-100);
    font-weight: 700;
    color: var(--tpl-gray-800);
}

/* Paginazione allineata ai bottoni del tema. */
.e-grid .e-gridpager {
    border: 0;
    border-top: 1px solid var(--bs-border-color);
    background-color: transparent;
    font-size: 0.8rem;
    color: var(--tpl-gray-600);
}

.e-grid .e-gridpager .e-numericitem {
    color: var(--tpl-gray-600);
}

.e-grid .e-gridpager .e-numericitem.e-currentitem {
    background-color: var(--bs-primary);
    border-radius: var(--bs-border-radius);
    color: #fff;
}

/* Selettore delle colonne e menu dei filtri. */
.e-ccdlg .e-dlg-content,
.e-filter-popup {
    font-size: 0.85rem;
}

.e-ccdlg .e-cc-searchdiv {
    border-color: var(--bs-border-color);
}

/* Le celle con badge o pulsanti non devono essere schiacciate. */
.e-grid .e-rowcell .badge {
    font-weight: 600;
}

.e-grid .e-rowcell .btn-sm {
    padding: 0.15rem 0.4rem;
}

/* ---------------------------------------------------------------
   7. Scroll-to-top
   --------------------------------------------------------------- */

.scroll-to-top {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    display: none;
    width: 2.75rem;
    height: 2.75rem;
    text-align: center;
    color: #fff;
    background: rgba(90, 92, 105, 0.5);
    line-height: 2.75rem;
    border-radius: var(--bs-border-radius);
    z-index: 1030;
}

.scroll-to-top.is-visible {
    display: block;
}

.scroll-to-top:hover {
    color: #fff;
    background: var(--tpl-gray-800);
}

/* ---------------------------------------------------------------
   8. Footer
   --------------------------------------------------------------- */

.sticky-footer {
    padding: 2rem 0;
    flex-shrink: 0;
}

.sticky-footer .copyright {
    line-height: 1;
    font-size: 0.8rem;
}

/* ---------------------------------------------------------------
   9. Avatar
   --------------------------------------------------------------- */

.avatar {
    object-fit: cover;
    flex-shrink: 0;
}

.avatar-iniziali {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
}

/* ---------------------------------------------------------------
   10. Profilo utente (Account/Manage)
   --------------------------------------------------------------- */

.profilo-page {
    max-width: 68rem;
    margin: 0 auto;
}

.profilo-hero,
.profilo-card {
    background-color: #fff;
    border: 1px solid var(--bs-border-color);
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.profilo-hero {
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.profilo-hero-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.25rem;
    padding: 2rem;
    background: linear-gradient(115deg, #111827 0%, #0f1b2d 55%, #05291d 100%);
    color: #fff;
}

.profilo-avatar {
    position: relative;
    width: 5rem;
    height: 5rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(74, 222, 128, 0.6);
    border-radius: 1rem;
    background: linear-gradient(145deg, #22c55e, #15803d);
    font-size: 1.6rem;
    font-weight: 800;
    color: #fff;
}

.profilo-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.profilo-avatar-online {
    position: absolute;
    right: -0.4rem;
    bottom: -0.4rem;
    width: 1.1rem;
    height: 1.1rem;
    border: 3px solid #fff;
    border-radius: 50%;
    background-color: #22c55e;
}

/* Base di 18rem: sotto quella larghezza il pulsante di logout va a capo invece di schiacciare i dati. */
.profilo-hero-info {
    flex: 1 1 18rem;
    min-width: 0;
}

.profilo-hero-name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
}

.profilo-hero-name h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}

.profilo-badge-ruolo {
    padding: 0.15rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid rgba(74, 222, 128, 0.45);
    border-radius: 999px;
    background-color: rgba(22, 163, 74, 0.18);
    color: #4ade80;
}

.profilo-hero-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.4rem;
    font-size: 0.92rem;
    color: #e5e7eb;
}

.profilo-hero-meta i {
    margin-right: 0.25rem;
    color: #94a3b8;
}

.profilo-hero-sep {
    color: #64748b;
}

.profilo-hero-accesso {
    margin-top: 0.3rem;
    font-size: 0.78rem;
    color: #94a3b8;
}

.profilo-btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    border: 0;
    border-radius: 0.6rem;
    background-color: #e11d48;
    color: #fff;
}

.profilo-btn-logout:hover {
    background-color: #be123c;
}

.profilo-tabs {
    display: flex;
    gap: 0.25rem;
    padding: 0 1.5rem;
    overflow-x: auto;
}

.profilo-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.95rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    color: #334155;
    text-decoration: none;
}

.profilo-tab i {
    color: #64748b;
}

.profilo-tab:hover {
    color: #0f172a;
}

.profilo-tab.active {
    border-bottom-color: #16a34a;
    color: #15803d;
}

.profilo-tab.active i {
    color: #16a34a;
}

.profilo-tab.is-disabled {
    cursor: default;
    color: #94a3b8;
}

.profilo-tab.is-disabled i {
    color: #cbd5e1;
}

.profilo-card {
    padding: 2rem;
}

.profilo-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 1.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #eef0f4;
}

.profilo-btn-dark,
.profilo-btn-primary,
.profilo-btn-light {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
    border: 0;
    border-radius: 0.6rem;
    text-decoration: none;
}

.profilo-btn-dark {
    background-color: #0f172a;
    color: #fff;
}

.profilo-btn-dark:hover {
    background-color: #1e293b;
    color: #fff;
}

.profilo-btn-primary {
    background-color: #16a34a;
    color: #fff;
}

.profilo-btn-primary:hover {
    background-color: #15803d;
    color: #fff;
}

.profilo-btn-light {
    background-color: #f1f5f9;
    color: #334155;
}

.profilo-btn-light:hover {
    background-color: #e2e8f0;
    color: #0f172a;
}

.profilo-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem 1.5rem;
}

.profilo-field-hint {
    display: inline-block;
    margin-top: 0.35rem;
    font-size: 0.75rem;
    color: #15803d;
}

.profilo-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.profilo-privilegi {
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid #eef0f4;
}

.profilo-section-label {
    margin-bottom: 0.75rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #475569;
}

.profilo-chips {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
    gap: 0.75rem;
}

.profilo-chip {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 0.9rem;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid #bbf7d0;
    border-radius: 0.6rem;
    background-color: #ecfdf3;
    color: #14532d;
}

.profilo-chip i {
    color: #16a34a;
}

/* Sottomenu della scheda Sicurezza */
.profilo-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-bottom: 1.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #eef0f4;
}

.profilo-subnav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 999px;
    background-color: #f1f5f9;
    color: #475569;
    text-decoration: none;
}

.profilo-subnav-link:hover {
    background-color: #e2e8f0;
    color: #0f172a;
}

.profilo-subnav-link.active {
    background-color: #16a34a;
    color: #fff;
}

@media (max-width: 767.98px) {
    .profilo-hero-top {
        padding: 1.5rem;
    }

    .profilo-card {
        padding: 1.25rem;
    }

    .profilo-grid {
        grid-template-columns: 1fr;
    }
}

/* G: mi serve determinare i colori delle griglie*/
.e-grid .e-row.riga-cessata td,
.e-grid .e-row.riga-cessata td.e-leftfreeze,
.e-grid .e-row.riga-cessata td.e-rightfreeze {
    background-color: #fef2f2 !important;
}

.e-grid .e-row.riga-cessata:hover td {
    background-color: #fee2e2 !important;
}

.e-grid .e-row.riga-in-cessazione td,
.e-grid .e-row.riga-in-cessazione td.e-leftfreeze,
.e-grid .e-row.riga-in-cessazione td.e-rightfreeze {
    background-color: #fff7ed !important;
}

.e-grid .e-row.riga-in-cessazione:hover td {
    background-color: #ffedd5 !important;
}

