/* ===========================================
   SIDEBAR E ELENCO CARTELLE
   File: sidebar.css
   =========================================== */

/* ===========================================
   SCROLL SIDEBAR - Una sola scrollbar principale
   =========================================== */

/* Il contenitore scrollabile della sidebar è il .scroller */
#layout-sidebar .scroller,
#layout-sidebar .simplebar-content-wrapper {
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

/* Rimuovi scrollbar interne dai contenitori cartelle */
#mailboxlist,
#mailboxlist ul,
.mailbox-dropdown-container,
.my-folders-dropdown {
    overflow: visible !important;
    max-height: none !important;
}

/* ===========================================
   BOTTONE SPLIT "NUOVO MESSAGGIO" (in cima alla sidebar)
   =========================================== */
.compose-button-wrapper {
    padding: 12px 12px 8px 12px;
}

/* Container split button */
.split-button {
    display: flex !important;
    width: 100% !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

/* Parte principale - Nuovo messaggio */
.split-button-main,
.split-button-main:link,
.split-button-main:visited,
.split-button-main:active,
a.split-button-main,
#layout-sidebar .split-button-main,
.compose-button-wrapper .split-button-main {
    flex: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 12px 16px !important;
    background: var(--primary-color, #000) !important;
    color: #ffffff !important;
    border: none !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.split-button-main:hover,
a.split-button-main:hover,
#layout-sidebar .split-button-main:hover {
    filter: brightness(1.15) !important;
    color: #ffffff !important;
}

/* Parte dropdown - freccia */
.split-button-dropdown {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 40px !important;
    background: var(--primary-color, #000) !important;
    border-left: 1px solid rgba(255, 255, 255, 0.2) !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    text-decoration: none !important;
}

.split-button-dropdown:hover {
    filter: brightness(1.3) !important;
}

/* Icona freccia */
.split-button-dropdown .icon:after {
    content: '\f078';
    font-family: Icons, 'Font Awesome 6 Free', sans-serif;
    font-weight: 900;
    font-size: 11px;
    color: #fff;
}

/* ===========================================
   MENU DROPDOWN NUOVO ELEMENTO
   =========================================== */
#newitem-menu {
    min-width: 200px !important;
}

#newitem-menu .newitem-list {
    padding: 8px 0 !important;
}

#newitem-menu .newitem-list li {
    margin: 0 !important;
    padding: 0 !important;
}

#newitem-menu .newitem-list li a {
    display: flex !important;
    align-items: center !important;
    padding: 10px 16px !important;
    color: #333 !important;
    text-decoration: none !important;
    font-size: 14px !important;
    transition: background 0.15s ease !important;
}

#newitem-menu .newitem-list li a:hover {
    background: #f5f5f5 !important;
}

/* Icone menu */
#newitem-menu .newitem-list li a:before {
    font-family: Icons, 'Font Awesome 6 Free', sans-serif;
    font-weight: 900;
    font-size: 14px;
    width: 24px;
    margin-right: 10px;
    color: var(--primary-color, #000);
    text-align: center;
}

#newitem-menu .newitem-list li a.newappointment:before {
    content: '\f073';
}

#newitem-menu .newitem-list li a.newcontact:before {
    content: '\f007';
}

#newitem-menu .newitem-list li a.newtask:before {
    content: '\f0ae';
}

/* Dark mode */
html.dark-mode .split-button-main,
html.dark-mode .split-button-dropdown {
    background: var(--primary-color, #333) !important;
}

html.dark-mode #newitem-menu .newitem-list li a {
    color: #eee !important;
}

html.dark-mode #newitem-menu .newitem-list li a:hover {
    background: #333 !important;
}

/* Sidebar base */
#layout-sidebar,
.sidebar,
html body #layout-sidebar {
    background-color: var(--sidebar-color, #e6e6e6) !important;
}

/* ===========================================
   DROPDOWN CARTELLE PRINCIPALI
   =========================================== */

/* Container del dropdown */
.mailbox-dropdown-container {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Header del dropdown (email utente) */
.mailbox-dropdown-header {
    display: flex !important;
    align-items: center !important;
    padding: 8px 12px 8px 19px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    user-select: none !important;
    border: none !important;
}

.mailbox-dropdown-header:hover {
    background: rgba(0, 0, 0, 0.03) !important;
}

/* Freccia a sinistra */
.mailbox-dropdown-header .dropdown-icon {
    width: 24px;
    height: 28px;
    margin-right: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.mailbox-dropdown-header .dropdown-icon:before {
    content: '\f078';
    font-family: Icons, 'Font Awesome 6 Free', sans-serif;
    font-weight: 900;
    font-size: 10px;
    color: #666;
}

/* Email utente */
.mailbox-dropdown-header .dropdown-email {
    flex: 1 !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    color: #333 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

/* Rimuovi freccia destra - non serve più */
.mailbox-dropdown-header .dropdown-arrow {
    display: none !important;
}

/* Contenuto dropdown (lista cartelle) - nessuna scrollbar interna */
.mailbox-dropdown-content {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    max-height: none !important;
    opacity: 1 !important;
}

/* Stato collapsed - ruota freccia a sinistra */
.mailbox-dropdown-container.collapsed .dropdown-icon {
    transform: rotate(-90deg) !important;
}

.mailbox-dropdown-container.collapsed .mailbox-dropdown-content {
    max-height: 0 !important;
    opacity: 0 !important;
}

/* Stile cartelle dentro il dropdown - COMPATTO */
.mailbox-dropdown-content > li.mailbox {
    margin: 0 !important;
    border: none !important;
}

.mailbox-dropdown-content > li.mailbox:last-child {
    border: none !important;
}

.mailbox-dropdown-content > li.mailbox > a {
    padding: 4px 12px 4px 75px !important;
    margin: 0 8px !important;
    font-size: 14px !important;
    line-height: 20px !important;
    color: #333 !important;
    display: flex !important;
    align-items: center !important;
    transition: background 0.15s ease !important;
    border-radius: 6px !important;
    position: relative !important;
}

.mailbox-dropdown-content > li.mailbox > a:hover {
    background: rgba(0, 0, 0, 0.04) !important;
}

.mailbox-dropdown-content > li.mailbox.selected > a {
    background: var(--primary-color, #000) !important;
    color: #fff !important;
    font-weight: 500 !important;
}

/* Icona bianca per cartella selezionata */
.mailbox-dropdown-content > li.mailbox.selected > a:before {
    filter: brightness(0) invert(1) !important;
}

/* Nascondi treetoggle originale dentro dropdown e nel container
   ECCETTO per le cartelle con sottocartelle (.haschildren) */
.mailbox-dropdown-content > li.mailbox:not(.haschildren) > .treetoggle,
.mailbox-dropdown-container > .treetoggle,
#main-folders-dropdown > .treetoggle,
.mailbox-dropdown-header + .treetoggle,
.mailbox-dropdown-header ~ .treetoggle:not([data-toggle-init]) {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* Icone delle cartelle principali - posizionate a sinistra */
.mailbox-dropdown-content > li.mailbox > a:before {
    content: '' !important;
    position: absolute !important;
    left: 43px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 18px !important;
    height: 18px !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
}

/* Icone specifiche per ogni cartella - SVG inline */
.mailbox-dropdown-content > li.mailbox.inbox > a:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23333' viewBox='0 0 16 16'%3E%3Cpath d='M4.98 4a.5.5 0 0 0-.39.188L1.54 8H6a.5.5 0 0 1 .5.5 1.5 1.5 0 1 0 3 0A.5.5 0 0 1 10 8h4.46l-3.05-3.812A.5.5 0 0 0 11.02 4zm9.954 5H10.45a2.5 2.5 0 0 1-4.9 0H1.066l.32 2.562a.5.5 0 0 0 .497.438h12.234a.5.5 0 0 0 .496-.438zM3.809 3.563A1.5 1.5 0 0 1 4.981 3h6.038a1.5 1.5 0 0 1 1.172.563l3.7 4.625a.5.5 0 0 1 .105.374l-.39 3.124A1.5 1.5 0 0 1 14.117 13H1.883a1.5 1.5 0 0 1-1.489-1.314l-.39-3.124a.5.5 0 0 1 .106-.374z'/%3E%3C/svg%3E") !important;
}

.mailbox-dropdown-content > li.mailbox.drafts > a:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23333' viewBox='0 0 16 16'%3E%3Cpath d='M14 4.5V14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h5.5zm-3 0A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4.5z'/%3E%3C/svg%3E") !important;
}

.mailbox-dropdown-content > li.mailbox.sent > a:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23333' viewBox='0 0 16 16'%3E%3Cpath d='M15.854.146a.5.5 0 0 1 .11.54l-5.819 14.547a.75.75 0 0 1-1.329.124l-3.178-4.995L.643 7.184a.75.75 0 0 1 .124-1.33L15.314.037a.5.5 0 0 1 .54.11ZM6.636 10.07l2.761 4.338L14.13 2.576zm6.787-8.201L1.591 6.602l4.339 2.76z'/%3E%3C/svg%3E") !important;
}

.mailbox-dropdown-content > li.mailbox.junk > a:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23333' viewBox='0 0 16 16'%3E%3Cpath d='M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16'/%3E%3Cpath d='M11.354 4.646a.5.5 0 0 0-.708 0L8 7.293 5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0 0-.708'/%3E%3C/svg%3E") !important;
}

.mailbox-dropdown-content > li.mailbox.trash > a:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23333' viewBox='0 0 16 16'%3E%3Cpath d='M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z'/%3E%3Cpath d='M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4zM2.5 3h11V2h-11z'/%3E%3C/svg%3E") !important;
}

/* Icona Archivio - Bootstrap Icons archive outline */
.mailbox-dropdown-content > li.mailbox.archive > a:before,
.mailbox-dropdown-content > li.mailbox[id*="archiv"] > a:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23333' viewBox='0 0 16 16'%3E%3Cpath d='M0 2a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1v7.5a2.5 2.5 0 0 1-2.5 2.5h-9A2.5 2.5 0 0 1 1 12.5V5a1 1 0 0 1-1-1zm2 3v7.5A1.5 1.5 0 0 0 3.5 14h9a1.5 1.5 0 0 0 1.5-1.5V5zm13-3H1v2h14zM5 7.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5'/%3E%3C/svg%3E") !important;
}

/* Fix: Archivio e sottocartelle - font normale (non bold) */
.mailbox-dropdown-content > li.mailbox.archive > a,
.mailbox-dropdown-content > li.mailbox[id*="archiv"] > a,
.mailbox-dropdown-content > li.mailbox.archive > ul > li > a,
.mailbox-dropdown-content > li.mailbox[id*="archiv"] > ul > li > a {
    font-weight: 400 !important;
}

/* Badge conteggio non letti - solo testo senza sfondo (stato normale) */
.mailbox-dropdown-content > li.mailbox .unreadcount,
.my-folders-content > li.mailbox .unreadcount,
#mailboxlist li.mailbox .unreadcount {
    background: transparent !important;
    color: #333 !important;
    font-size: 15px !important;
    font-weight: 900 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    min-width: auto !important;
    text-align: right !important;
    position: absolute !important;
    right: 4px !important;
    top: 0px !important;
    transform: none !important;
    z-index: 5 !important;
    line-height: 1 !important;
}

/* Numeri singola cifra (< 10) - margine right maggiore */
.mailbox-dropdown-content > li.mailbox .unreadcount.single-digit,
.my-folders-content > li.mailbox .unreadcount.single-digit,
#mailboxlist li.mailbox .unreadcount.single-digit {
    right: 7px !important;
}

/* Hover - sposta unreadcount a sinistra per fare spazio ai tre puntini */
.mailbox-dropdown-content > li.mailbox:hover .unreadcount,
.my-folders-content > li.mailbox:hover .unreadcount,
#mailboxlist li.mailbox:hover .unreadcount {
    right: 35px !important;
}

/* Dark mode - badge unreadcount testo chiaro */
html.dark-mode .mailbox-dropdown-content > li.mailbox .unreadcount,
html.dark-mode .my-folders-content > li.mailbox .unreadcount,
html.dark-mode #mailboxlist li.mailbox .unreadcount {
    color: #ccc !important;
}

/* Dark mode */
html.dark-mode .mailbox-dropdown-header {
    border: none !important;
}

html.dark-mode .mailbox-dropdown-header:hover {
    background: rgba(255, 255, 255, 0.03) !important;
}

html.dark-mode .mailbox-dropdown-header .dropdown-email {
    color: #eee !important;
}

html.dark-mode .mailbox-dropdown-header .dropdown-icon:before {
    color: #aaa !important;
}

html.dark-mode .mailbox-dropdown-content > li.mailbox {
    border: none !important;
}

html.dark-mode .mailbox-dropdown-content > li.mailbox:last-child {
    border: none !important;
}

html.dark-mode .mailbox-dropdown-content > li.mailbox > a {
    color: #ddd !important;
}

html.dark-mode .mailbox-dropdown-content > li.mailbox > a:hover {
    background: rgba(255, 255, 255, 0.03) !important;
}

html.dark-mode .mailbox-dropdown-content > li.mailbox.selected > a {
    background: var(--primary-color, #666) !important;
    color: #fff !important;
}

html.dark-mode .mailbox-dropdown-content > li.mailbox.selected > a:before {
    filter: brightness(0) invert(1) !important;
}

/* ===========================================
   SOTTOCARTELLE NELLE CARTELLE PRINCIPALI
   =========================================== */

/* Posizionamento relativo per cartelle con figli */
.mailbox-dropdown-content > li.mailbox.haschildren {
    position: relative !important;
}

/* Mostra treetoggle per cartelle con sottocartelle nel dropdown principale */
.mailbox-dropdown-content > li.mailbox.haschildren > .treetoggle,
.mailbox-dropdown-content > li.mailbox.haschildren > div.treetoggle,
.mailbox-dropdown-content > li.mailbox.haschildren > span.treetoggle {
    display: flex !important;
    visibility: visible !important;
    width: 24px !important;
    height: 28px !important;
    overflow: visible !important;
    position: absolute !important;
    left: 22px !important;
    top: 0 !important;
    cursor: pointer !important;
    z-index: 100 !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
}

.mailbox-dropdown-content > li.mailbox.haschildren > .treetoggle:before,
.mailbox-dropdown-content > li.mailbox.haschildren > div.treetoggle:before,
.mailbox-dropdown-content > li.mailbox.haschildren > span.treetoggle:before {
    content: '' !important;
    display: block !important;
    width: 18px !important;
    height: 18px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23333' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708'/%3E%3C/svg%3E") !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    transition: transform 0.15s ease !important;
    transform: rotate(-90deg) !important;
}

/* Freccia ruotata quando expanded (punta in basso) */
.mailbox-dropdown-content > li.mailbox.haschildren.expanded > .treetoggle:before,
.mailbox-dropdown-content > li.mailbox.haschildren.expanded > div.treetoggle:before,
.mailbox-dropdown-content > li.mailbox.haschildren.expanded > span.treetoggle:before,
.mailbox-dropdown-content > li.mailbox.haschildren > .treetoggle.expanded:before,
.mailbox-dropdown-content > li.mailbox.haschildren > div.treetoggle.expanded:before {
    transform: rotate(0deg) !important;
}

/* Cartelle con sottocartelle - stesso padding delle altre */
.mailbox-dropdown-content > li.mailbox.haschildren > a {
    padding-left: 75px !important;
}

.mailbox-dropdown-content > li.mailbox.haschildren > a:before {
    left: 43px !important;
}

/* Stile sottocartelle - contenitore */
.mailbox-dropdown-content > li.mailbox > ul {
    padding: 0 0 0 10px !important;
    margin: 0 !important;
    list-style: none !important;
    display: none !important;
    overflow: hidden !important;
    border: none !important;
    background: transparent !important;
}

/* Mostra sottocartelle quando expanded */
.mailbox-dropdown-content > li.mailbox.expanded > ul {
    display: block !important;
    border: none !important;
}

/* Rimuovi linea bianca tra cartella e sottocartelle */
.mailbox-dropdown-content > li.mailbox.expanded > a {
    border-bottom: none !important;
    border: none !important;
}

.mailbox-dropdown-content > li.mailbox.expanded {
    border: none !important;
}

.mailbox-dropdown-content > li.mailbox.expanded > ul,
.mailbox-dropdown-content > li.mailbox.expanded > ul > li,
.mailbox-dropdown-content > li.mailbox.expanded > ul > li > a {
    border: none !important;
    box-shadow: none !important;
}

/* ===========================================
   DROPDOWN "LE MIE CARTELLE" - Cartelle personalizzate
   =========================================== */

/* Stile per cartelle personali - usa icona folder */
.mailbox-dropdown-content > li.mailbox.personal-folder > a:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23333' viewBox='0 0 16 16'%3E%3Cpath d='M.54 3.87.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3h3.982a2 2 0 0 1 1.992 2.181l-.637 7A2 2 0 0 1 13.174 14H2.826a2 2 0 0 1-1.991-1.819l-.637-7a2 2 0 0 1 .342-1.31zM2.19 4a1 1 0 0 0-.996 1.09l.637 7a1 1 0 0 0 .995.91h10.348a1 1 0 0 0 .995-.91l.637-7A1 1 0 0 0 13.81 4zm4.69-1.707A1 1 0 0 0 6.172 2H2.5a1 1 0 0 0-1 .981l.006.139q.323-.119.684-.12h5.396z'/%3E%3C/svg%3E") !important;
}

/* Dark mode per cartelle personali */
html.dark-mode .mailbox-dropdown-content > li.mailbox.personal-folder > a:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23ccc' viewBox='0 0 16 16'%3E%3Cpath d='M.54 3.87.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3h3.982a2 2 0 0 1 1.992 2.181l-.637 7A2 2 0 0 1 13.174 14H2.826a2 2 0 0 1-1.991-1.819l-.637-7a2 2 0 0 1 .342-1.31zM2.19 4a1 1 0 0 0-.996 1.09l.637 7a1 1 0 0 0 .995.91h10.348a1 1 0 0 0 .995-.91l.637-7A1 1 0 0 0 13.81 4zm4.69-1.707A1 1 0 0 0 6.172 2H2.5a1 1 0 0 0-1 .981l.006.139q.323-.119.684-.12h5.396z'/%3E%3C/svg%3E") !important;
}

/* Separazione tra i due dropdown */
.my-folders-dropdown {
    margin-top: 8px !important;
    padding-top: 8px !important;
    border-top: 1px solid rgba(0, 0, 0, 0.06) !important;
}

/* Contenuto Le mie cartelle - nessuna scrollbar interna, tutto visibile */
.my-folders-dropdown .mailbox-dropdown-content,
.my-folders-dropdown .my-folders-content {
    max-height: none !important;
    overflow: visible !important;
}

/* Assicura che le cartelle personali siano visibili */
.my-folders-dropdown .mailbox-dropdown-content > li.mailbox,
.my-folders-content > li.mailbox {
    display: list-item !important;
    visibility: visible !important;
}

/* Stile per tutte le cartelle dentro Le mie cartelle */
.my-folders-content > li.mailbox > a {
    padding: 4px 12px 4px 75px !important;
    margin: 0 8px !important;
    font-size: 14px !important;
    line-height: 20px !important;
    color: #333 !important;
    display: flex !important;
    align-items: center !important;
    transition: background 0.15s ease !important;
    border-radius: 6px !important;
    position: relative !important;
}

.my-folders-content > li.mailbox > a:hover {
    background: rgba(0, 0, 0, 0.04) !important;
}

.my-folders-content > li.mailbox.selected > a {
    background: var(--primary-color, #000) !important;
    color: #fff !important;
    font-weight: 500 !important;
}

.my-folders-content > li.mailbox.selected > a:before {
    filter: brightness(0) invert(1) !important;
}

/* Icona folder per cartelle in Le mie cartelle */
.my-folders-content > li.mailbox > a:before {
    content: '' !important;
    position: absolute !important;
    left: 43px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 18px !important;
    height: 18px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23333' viewBox='0 0 16 16'%3E%3Cpath d='M.54 3.87.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3h3.982a2 2 0 0 1 1.992 2.181l-.637 7A2 2 0 0 1 13.174 14H2.826a2 2 0 0 1-1.991-1.819l-.637-7a2 2 0 0 1 .342-1.31zM2.19 4a1 1 0 0 0-.996 1.09l.637 7a1 1 0 0 0 .995.91h10.348a1 1 0 0 0 .995-.91l.637-7A1 1 0 0 0 13.81 4zm4.69-1.707A1 1 0 0 0 6.172 2H2.5a1 1 0 0 0-1 .981l.006.139q.323-.119.684-.12h5.396z'/%3E%3C/svg%3E") !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
}

/* Dark mode per Le mie cartelle */
html.dark-mode .my-folders-content > li.mailbox > a {
    color: #ddd !important;
}

html.dark-mode .my-folders-content > li.mailbox > a:hover {
    background: rgba(255, 255, 255, 0.03) !important;
}

html.dark-mode .my-folders-content > li.mailbox.selected > a {
    background: var(--primary-color, #666) !important;
    color: #fff !important;
}

html.dark-mode .my-folders-content > li.mailbox.selected > a:before {
    filter: brightness(0) invert(1) !important;
}

html.dark-mode .my-folders-content > li.mailbox > a:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23ccc' viewBox='0 0 16 16'%3E%3Cpath d='M.54 3.87.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3h3.982a2 2 0 0 1 1.992 2.181l-.637 7A2 2 0 0 1 13.174 14H2.826a2 2 0 0 1-1.991-1.819l-.637-7a2 2 0 0 1 .342-1.31zM2.19 4a1 1 0 0 0-.996 1.09l.637 7a1 1 0 0 0 .995.91h10.348a1 1 0 0 0 .995-.91l.637-7A1 1 0 0 0 13.81 4zm4.69-1.707A1 1 0 0 0 6.172 2H2.5a1 1 0 0 0-1 .981l.006.139q.323-.119.684-.12h5.396z'/%3E%3C/svg%3E") !important;
}

/* Sottocartelle in Le mie cartelle */
.my-folders-content > li.mailbox > ul {
    padding: 0 0 0 10px !important;
    margin: 0 !important;
    list-style: none !important;
    display: none !important;
    overflow: hidden !important;
    border: none !important;
    background: transparent !important;
}

.my-folders-content > li.mailbox.expanded > ul {
    display: block !important;
}

.my-folders-content > li.mailbox > ul > li > a {
    padding: 4px 12px 4px 75px !important;
    margin: 0 8px !important;
    font-size: 14px !important;
    line-height: 20px !important;
    color: #333 !important;
    display: flex !important;
    align-items: center !important;
    position: relative !important;
    text-decoration: none !important;
    border-radius: 6px !important;
    transition: background 0.15s ease !important;
}

.my-folders-content > li.mailbox > ul > li > a:before {
    content: '' !important;
    position: absolute !important;
    left: 43px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 18px !important;
    height: 18px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23333' viewBox='0 0 16 16'%3E%3Cpath d='M.54 3.87.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3h3.982a2 2 0 0 1 1.992 2.181l-.637 7A2 2 0 0 1 13.174 14H2.826a2 2 0 0 1-1.991-1.819l-.637-7a2 2 0 0 1 .342-1.31zM2.19 4a1 1 0 0 0-.996 1.09l.637 7a1 1 0 0 0 .995.91h10.348a1 1 0 0 0 .995-.91l.637-7A1 1 0 0 0 13.81 4zm4.69-1.707A1 1 0 0 0 6.172 2H2.5a1 1 0 0 0-1 .981l.006.139q.323-.119.684-.12h5.396z'/%3E%3C/svg%3E") !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
}

html.dark-mode .my-folders-content > li.mailbox > ul > li > a {
    color: #ddd !important;
}

html.dark-mode .my-folders-content > li.mailbox > ul > li > a:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23ccc' viewBox='0 0 16 16'%3E%3Cpath d='M.54 3.87.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3h3.982a2 2 0 0 1 1.992 2.181l-.637 7A2 2 0 0 1 13.174 14H2.826a2 2 0 0 1-1.991-1.819l-.637-7a2 2 0 0 1 .342-1.31zM2.19 4a1 1 0 0 0-.996 1.09l.637 7a1 1 0 0 0 .995.91h10.348a1 1 0 0 0 .995-.91l.637-7A1 1 0 0 0 13.81 4zm4.69-1.707A1 1 0 0 0 6.172 2H2.5a1 1 0 0 0-1 .981l.006.139q.323-.119.684-.12h5.396z'/%3E%3C/svg%3E") !important;
}

/* Treetoggle per haschildren in Le mie cartelle */
.my-folders-content > li.mailbox.haschildren > .treetoggle,
.my-folders-content > li.mailbox.haschildren > div.treetoggle {
    display: flex !important;
    visibility: visible !important;
    width: 24px !important;
    height: 28px !important;
    overflow: visible !important;
    position: absolute !important;
    left: 22px !important;
    top: 0 !important;
    cursor: pointer !important;
    z-index: 100 !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
}

.my-folders-content > li.mailbox.haschildren > .treetoggle:before,
.my-folders-content > li.mailbox.haschildren > div.treetoggle:before {
    content: '' !important;
    display: block !important;
    width: 18px !important;
    height: 18px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23333' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708'/%3E%3C/svg%3E") !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    transition: transform 0.15s ease !important;
    transform: rotate(-90deg) !important;
}

.my-folders-content > li.mailbox.haschildren.expanded > .treetoggle:before,
.my-folders-content > li.mailbox.haschildren.expanded > div.treetoggle:before,
.my-folders-content > li.mailbox.haschildren > .treetoggle.expanded:before,
.my-folders-content > li.mailbox.haschildren > div.treetoggle.expanded:before {
    transform: rotate(0deg) !important;
}

html.dark-mode .my-folders-content > li.mailbox.haschildren > .treetoggle:before,
html.dark-mode .my-folders-content > li.mailbox.haschildren > div.treetoggle:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23ccc' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708'/%3E%3C/svg%3E") !important;
}

/* Posizionamento relativo per le cartelle con sottocartelle */
.my-folders-content > li.mailbox.haschildren {
    position: relative !important;
}

/* Fix tre puntini per cartelle con sottocartelle in Le mie cartelle */
.my-folders-content > li.mailbox.haschildren > .folder-actions-btn {
    top: 14px !important;
    transform: translateY(-50%) !important;
}

html.dark-mode .my-folders-dropdown {
    border-top-color: rgba(255, 255, 255, 0.06) !important;
}

/* Stile singola sottocartella */
.mailbox-dropdown-content > li.mailbox > ul > li {
    padding: 0 !important;
    margin: 0 !important;
    position: relative !important;
}

.mailbox-dropdown-content > li.mailbox > ul > li > a {
    padding: 4px 12px 4px 75px !important;
    margin: 0 8px !important;
    font-size: 14px !important;
    line-height: 20px !important;
    color: #333 !important;
    display: flex !important;
    align-items: center !important;
    position: relative !important;
    text-decoration: none !important;
    transition: background 0.15s ease !important;
    border-radius: 6px !important;
}

/* Icona cartella per sottocartelle - SVG inline (folder outline) */
.mailbox-dropdown-content > li.mailbox > ul > li > a:before {
    content: '' !important;
    position: absolute !important;
    left: 43px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 18px !important;
    height: 18px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23333' viewBox='0 0 16 16'%3E%3Cpath d='M.54 3.87.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3h3.982a2 2 0 0 1 1.992 2.181l-.637 7A2 2 0 0 1 13.174 14H2.826a2 2 0 0 1-1.991-1.819l-.637-7a2 2 0 0 1 .342-1.31zM2.19 4a1 1 0 0 0-.996 1.09l.637 7a1 1 0 0 0 .995.91h10.348a1 1 0 0 0 .995-.91l.637-7A1 1 0 0 0 13.81 4zm4.69-1.707A1 1 0 0 0 6.172 2H2.5a1 1 0 0 0-1 .981l.006.139q.323-.119.684-.12h5.396z'/%3E%3C/svg%3E") !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
}

.mailbox-dropdown-content > li.mailbox > ul > li > a:hover {
    background: rgba(0, 0, 0, 0.04) !important;
}

.mailbox-dropdown-content > li.mailbox > ul > li.selected > a,
.mailbox-dropdown-content > li.mailbox > ul li.selected > a,
.mailbox-dropdown-content li.mailbox ul li.selected > a,
#mailboxlist .mailbox-dropdown-content li.selected > a {
    background: var(--primary-color, #000) !important;
    color: #fff !important;
    font-weight: 500 !important;
}

.mailbox-dropdown-content > li.mailbox > ul > li.selected > a:before,
.mailbox-dropdown-content > li.mailbox > ul li.selected > a:before,
.mailbox-dropdown-content li.mailbox ul li.selected > a:before,
#mailboxlist .mailbox-dropdown-content li.selected > a:before {
    filter: brightness(0) invert(1) !important;
}

/* Dark mode sottocartelle */
html.dark-mode .mailbox-dropdown-content > li.mailbox.haschildren > .treetoggle:before,
html.dark-mode .mailbox-dropdown-content > li.mailbox.haschildren > div.treetoggle:before,
html.dark-mode .mailbox-dropdown-content > li.mailbox.haschildren > span.treetoggle:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23ccc' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708'/%3E%3C/svg%3E") !important;
}

html.dark-mode .mailbox-dropdown-content > li.mailbox > ul > li > a {
    color: #ddd !important;
}

html.dark-mode .mailbox-dropdown-content > li.mailbox > ul > li > a:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23ccc' viewBox='0 0 16 16'%3E%3Cpath d='M.54 3.87.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3h3.982a2 2 0 0 1 1.992 2.181l-.637 7A2 2 0 0 1 13.174 14H2.826a2 2 0 0 1-1.991-1.819l-.637-7a2 2 0 0 1 .342-1.31zM2.19 4a1 1 0 0 0-.996 1.09l.637 7a1 1 0 0 0 .995.91h10.348a1 1 0 0 0 .995-.91l.637-7A1 1 0 0 0 13.81 4zm4.69-1.707A1 1 0 0 0 6.172 2H2.5a1 1 0 0 0-1 .981l.006.139q.323-.119.684-.12h5.396z'/%3E%3C/svg%3E") !important;
}

/* Dark mode icone cartelle principali */
html.dark-mode .mailbox-dropdown-content > li.mailbox.inbox > a:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23ccc' viewBox='0 0 16 16'%3E%3Cpath d='M4.98 4a.5.5 0 0 0-.39.188L1.54 8H6a.5.5 0 0 1 .5.5 1.5 1.5 0 1 0 3 0A.5.5 0 0 1 10 8h4.46l-3.05-3.812A.5.5 0 0 0 11.02 4zm9.954 5H10.45a2.5 2.5 0 0 1-4.9 0H1.066l.32 2.562a.5.5 0 0 0 .497.438h12.234a.5.5 0 0 0 .496-.438zM3.809 3.563A1.5 1.5 0 0 1 4.981 3h6.038a1.5 1.5 0 0 1 1.172.563l3.7 4.625a.5.5 0 0 1 .105.374l-.39 3.124A1.5 1.5 0 0 1 14.117 13H1.883a1.5 1.5 0 0 1-1.489-1.314l-.39-3.124a.5.5 0 0 1 .106-.374z'/%3E%3C/svg%3E") !important;
}

html.dark-mode .mailbox-dropdown-content > li.mailbox.drafts > a:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23ccc' viewBox='0 0 16 16'%3E%3Cpath d='M14 4.5V14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h5.5zm-3 0A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4.5z'/%3E%3C/svg%3E") !important;
}

html.dark-mode .mailbox-dropdown-content > li.mailbox.sent > a:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23ccc' viewBox='0 0 16 16'%3E%3Cpath d='M15.854.146a.5.5 0 0 1 .11.54l-5.819 14.547a.75.75 0 0 1-1.329.124l-3.178-4.995L.643 7.184a.75.75 0 0 1 .124-1.33L15.314.037a.5.5 0 0 1 .54.11ZM6.636 10.07l2.761 4.338L14.13 2.576zm6.787-8.201L1.591 6.602l4.339 2.76z'/%3E%3C/svg%3E") !important;
}

html.dark-mode .mailbox-dropdown-content > li.mailbox.junk > a:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23ccc' viewBox='0 0 16 16'%3E%3Cpath d='M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16'/%3E%3Cpath d='M11.354 4.646a.5.5 0 0 0-.708 0L8 7.293 5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0 0-.708'/%3E%3C/svg%3E") !important;
}

html.dark-mode .mailbox-dropdown-content > li.mailbox.trash > a:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23ccc' viewBox='0 0 16 16'%3E%3Cpath d='M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z'/%3E%3Cpath d='M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4zM2.5 3h11V2h-11z'/%3E%3C/svg%3E") !important;
}

html.dark-mode .mailbox-dropdown-content > li.mailbox.archive > a:before,
html.dark-mode .mailbox-dropdown-content > li.mailbox[id*="archiv"] > a:before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23ccc' viewBox='0 0 16 16'%3E%3Cpath d='M0 2a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1v7.5a2.5 2.5 0 0 1-2.5 2.5h-9A2.5 2.5 0 0 1 1 12.5V5a1 1 0 0 1-1-1zm2 3v7.5A1.5 1.5 0 0 0 3.5 14h9a1.5 1.5 0 0 0 1.5-1.5V5zm13-3H1v2h14zM5 7.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5'/%3E%3C/svg%3E") !important;
}

html.dark-mode .mailbox-dropdown-content > li.mailbox > ul > li > a:hover {
    background: rgba(255, 255, 255, 0.03) !important;
}

html.dark-mode .mailbox-dropdown-content > li.mailbox > ul > li.selected > a,
html.dark-mode .mailbox-dropdown-content > li.mailbox > ul li.selected > a,
html.dark-mode .mailbox-dropdown-content li.mailbox ul li.selected > a,
html.dark-mode #mailboxlist .mailbox-dropdown-content li.selected > a {
    background: var(--primary-color, #666) !important;
    color: #fff !important;
}

html.dark-mode .mailbox-dropdown-content > li.mailbox > ul > li.selected > a:before,
html.dark-mode .mailbox-dropdown-content > li.mailbox > ul li.selected > a:before,
html.dark-mode .mailbox-dropdown-content li.mailbox ul li.selected > a:before,
html.dark-mode #mailboxlist .mailbox-dropdown-content li.selected > a:before {
    filter: brightness(0) invert(1) !important;
}

/* ===========================================
   BOTTONE TRE PUNTINI - AZIONI CARTELLA
   =========================================== */
.folder-actions-btn {
    position: absolute !important;
    right: 8px !important;
    top: 14px !important;
    transform: translateY(-50%) !important;
    display: none !important;
    width: 24px !important;
    height: 24px !important;
    line-height: 24px !important;
    text-align: center !important;
    font-size: 12px !important;
    letter-spacing: 1px !important;
    color: #666 !important;
    cursor: pointer !important;
    border-radius: 4px !important;
    transition: all 0.15s ease !important;
    z-index: 10 !important;
}

.folder-actions-btn:hover {
    background: rgba(0, 0, 0, 0.1) !important;
    color: #333 !important;
}

/* Mostra i tre puntini al hover sulla cartella */
li.mailbox:hover > .folder-actions-btn,
.mailbox-dropdown-content > li.mailbox:hover > .folder-actions-btn,
.mailbox-dropdown-content > li.mailbox > ul > li.mailbox:hover > .folder-actions-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Posizionamento bottone azioni nelle sottocartelle */
.mailbox-dropdown-content > li.mailbox > ul > li.mailbox > .folder-actions-btn {
    right: 8px !important;
}

/* Fix: tre puntini per cartelle con sottocartelle - fissati in alto */
.mailbox-dropdown-content > li.mailbox.haschildren > .folder-actions-btn {
    top: 14px !important;
    transform: translateY(-50%) !important;
}

/* Mantieni unreadcount sempre visibile - posizionato prima dei tre puntini */
li.mailbox:hover > a .unreadcount {
    display: block !important;
}

/* ===========================================
   MENU POPUP AZIONI CARTELLA
   =========================================== */
#folder-actions-menu {
    display: none;
    position: fixed !important;
    z-index: 9999 !important;
    background: #fff !important;
    border-radius: 6px !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15) !important;
    min-width: 220px !important;
    overflow: hidden !important;
    height: auto !important;
    max-height: none !important;
}

#folder-actions-menu .folder-actions-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 4px 0 !important;
}

#folder-actions-menu .folder-actions-list li {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-top: none !important;
    border-bottom: none !important;
}

#folder-actions-menu .folder-actions-list li.separator {
    height: 1px !important;
    background: #e0e0e0 !important;
    margin: 3px 0 !important;
    padding: 0 !important;
}

#folder-actions-menu .folder-actions-list li a {
    display: flex !important;
    align-items: center !important;
    padding: 5px 10px !important;
    color: #333 !important;
    text-decoration: none !important;
    font-size: 13px !important;
    transition: background 0.15s ease !important;
    border: none !important;
}

#folder-actions-menu .folder-actions-list li a:hover {
    background: #f5f5f5 !important;
}

#folder-actions-menu .folder-actions-list li a.danger {
    color: #dc3545 !important;
}

#folder-actions-menu .folder-actions-list li a.danger:hover {
    background: #fff5f5 !important;
}

#folder-actions-menu .folder-actions-list li a .icon {
    width: 18px !important;
    margin-right: 8px !important;
    text-align: center !important;
    font-family: 'Font Awesome 6 Free', Icons, sans-serif !important;
}

/* Icone del menu azioni */
#folder-actions-menu a[data-action="new-subfolder"] .icon:before {
    content: '\f07b' !important;
    font-weight: 400 !important;
}

#folder-actions-menu a[data-action="add-favorite"] .icon:before {
    content: '\f005' !important;
    font-weight: 400 !important;
}

/* Stella piena per "Rimuovi dai preferiti" */
#folder-actions-menu a[data-action="add-favorite"].is-favorite .icon:before {
    content: '\f005' !important;
    font-weight: 900 !important;
    color: #f4c430 !important;
}

#folder-actions-menu a[data-action="rename-folder"] .icon:before {
    content: '\f304' !important; /* pen / edit */
    font-weight: 900 !important;
}

#folder-actions-menu a[data-action="mark-all-read"] .icon:before {
    content: '\f06e' !important;
    font-weight: 400 !important;
}

#folder-actions-menu a[data-action="move-all"] .icon:before {
    content: '\f07b' !important;
    font-weight: 900 !important;
}

#folder-actions-menu a[data-action="purge"] .icon:before {
    content: '\f1b8' !important;
    font-weight: 900 !important;
}

#folder-actions-menu a[data-action="archive-old"] .icon:before {
    content: '\f187' !important;
    font-weight: 900 !important;
}

#folder-actions-menu a[data-action="delete-all"] .icon:before,
#folder-actions-menu a[data-action="delete-folder"] .icon:before {
    content: '\f2ed' !important;
    font-weight: 400 !important;
    color: #dc3545 !important;
}

/* ===========================================
   PREFERITI DROPDOWN
   =========================================== */
#favorites-dropdown {
    border: none !important;
}

#favorites-dropdown .favorites-header {
    background: rgba(255, 215, 0, 0.1) !important;
    cursor: pointer !important;
}

#favorites-dropdown .favorites-header .dropdown-email {
    font-weight: 600 !important;
}

/* Freccia rotabile per collassare */
#favorites-dropdown .favorites-header .dropdown-icon {
    transition: transform 0.2s ease !important;
}

#favorites-dropdown .favorites-header .dropdown-icon:before {
    content: '\f078' !important;
    font-family: Icons, 'Font Awesome 6 Free', sans-serif !important;
    font-weight: 900 !important;
    font-size: 10px !important;
    color: #f4c430 !important;
}

/* Stato collapsed */
#favorites-dropdown.collapsed .favorites-header .dropdown-icon {
    transform: rotate(-90deg) !important;
}

#favorites-dropdown.collapsed .favorites-list {
    max-height: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
}

#favorites-dropdown .favorites-list {
    max-height: 300px !important;
    opacity: 1 !important;
    transition: max-height 0.3s ease, opacity 0.2s ease !important;
    overflow: hidden !important;
}

#favorites-dropdown .favorite-item {
    position: relative !important;
}

#favorites-dropdown .favorite-item a {
    padding: 6px 12px 6px 36px !important;
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    font-size: 13px !important;
    color: #444 !important;
    text-decoration: none !important;
    transition: background 0.15s ease !important;
}

#favorites-dropdown .favorite-item a:hover {
    background: rgba(0, 0, 0, 0.04) !important;
}

#favorites-dropdown .favorite-item a .favorite-star {
    position: absolute !important;
    left: 10px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: #f4c430 !important;
}

#favorites-dropdown .favorite-item a .favorite-star:before {
    content: '\f005' !important;
    font-family: 'Font Awesome 6 Free', Icons, sans-serif !important;
    font-weight: 900 !important;
    font-size: 12px !important;
}

/* Tre puntini per preferiti */
#favorites-dropdown .favorite-item .folder-actions-btn {
    position: absolute !important;
    right: 8px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

#favorites-dropdown .favorite-item:hover .folder-actions-btn {
    display: flex !important;
}

/* ===========================================
   FOLDER PICKER DIALOG
   =========================================== */
.folder-picker-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0, 0, 0, 0.5) !important;
    z-index: 10000 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.folder-picker-content {
    background: #fff !important;
    border-radius: 12px !important;
    width: 90% !important;
    max-width: 400px !important;
    max-height: 80vh !important;
    overflow: hidden !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2) !important;
}

.folder-picker-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 16px 20px !important;
    border-bottom: 1px solid #eee !important;
}

.folder-picker-header h3 {
    margin: 0 !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #333 !important;
}

.folder-picker-close {
    background: none !important;
    border: none !important;
    font-size: 24px !important;
    color: #999 !important;
    cursor: pointer !important;
    padding: 0 !important;
    line-height: 1 !important;
}

.folder-picker-close:hover {
    color: #333 !important;
}

.folder-picker-body {
    max-height: 400px !important;
    overflow-y: auto !important;
}

.folder-picker-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 8px 0 !important;
}

.folder-picker-list li a {
    display: block !important;
    padding: 12px 20px !important;
    color: #333 !important;
    text-decoration: none !important;
    font-size: 14px !important;
    transition: background 0.15s ease !important;
}

.folder-picker-list li a:hover {
    background: #f5f5f5 !important;
}

/* ===========================================
   DARK MODE
   =========================================== */
html.dark-mode .folder-actions-btn {
    color: #aaa !important;
}

html.dark-mode .folder-actions-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
}

html.dark-mode #folder-actions-menu {
    background: #2a2a2a !important;
}

html.dark-mode #folder-actions-menu .folder-actions-list li.separator {
    background: #444 !important;
}

html.dark-mode #folder-actions-menu .folder-actions-list li a {
    color: #eee !important;
}

html.dark-mode #folder-actions-menu .folder-actions-list li a:hover {
    background: #333 !important;
}

html.dark-mode #favorites-dropdown .favorites-header {
    background: rgba(255, 215, 0, 0.05) !important;
}

html.dark-mode .folder-picker-content {
    background: #2a2a2a !important;
}

html.dark-mode .folder-picker-header {
    border-bottom-color: #444 !important;
}

html.dark-mode .folder-picker-header h3 {
    color: #eee !important;
}

html.dark-mode .folder-picker-list li a {
    color: #eee !important;
}

html.dark-mode .folder-picker-list li a:hover {
    background: #333 !important;
}

/* ===========================================
   FOLDER DIALOG (Crea/Rinomina cartella)
   =========================================== */
.folder-dialog-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0, 0, 0, 0.5) !important;
    z-index: 10000 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    animation: fadeIn 0.15s ease !important;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.folder-dialog-content {
    background: #fff !important;
    border-radius: 12px !important;
    width: 90% !important;
    max-width: 400px !important;
    overflow: hidden !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25) !important;
    animation: slideUp 0.2s ease !important;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.folder-dialog-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 16px 20px !important;
    border-bottom: 1px solid #eee !important;
    background: #fafafa !important;
}

.folder-dialog-header h3 {
    margin: 0 !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #333 !important;
}

.folder-dialog-close {
    background: none !important;
    border: none !important;
    font-size: 24px !important;
    color: #999 !important;
    cursor: pointer !important;
    padding: 0 !important;
    line-height: 1 !important;
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 6px !important;
    transition: all 0.15s ease !important;
}

.folder-dialog-close:hover {
    color: #333 !important;
    background: rgba(0, 0, 0, 0.05) !important;
}

.folder-dialog-body {
    padding: 20px !important;
}

.folder-dialog-body .form-group {
    margin-bottom: 0 !important;
}

.folder-dialog-body label {
    display: block !important;
    margin-bottom: 8px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #555 !important;
}

.folder-dialog-body input[type="text"] {
    width: 100% !important;
    padding: 12px 14px !important;
    font-size: 14px !important;
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
    outline: none !important;
    transition: all 0.15s ease !important;
    box-sizing: border-box !important;
}

.folder-dialog-body input[type="text"]:focus {
    border-color: var(--primary-color, #000) !important;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1) !important;
}

.folder-dialog-body input[type="text"].error {
    border-color: #dc3545 !important;
    animation: shake 0.3s ease !important;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.folder-dialog-footer {
    display: flex !important;
    justify-content: flex-end !important;
    gap: 10px !important;
    padding: 16px 20px !important;
    border-top: 1px solid #eee !important;
    background: #fafafa !important;
}

.folder-dialog-footer .btn {
    padding: 10px 20px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    border: none !important;
}

.folder-dialog-cancel {
    background: #e9ecef !important;
    color: #495057 !important;
}

.folder-dialog-cancel:hover {
    background: #dee2e6 !important;
}

.folder-dialog-confirm {
    background: var(--primary-color, #000) !important;
    color: #fff !important;
}

.folder-dialog-confirm:hover {
    filter: brightness(1.15) !important;
}

.folder-dialog-confirm:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

/* Dark mode - Folder Dialog */
html.dark-mode .folder-dialog-content {
    background: #2a2a2a !important;
}

html.dark-mode .folder-dialog-header {
    background: #222 !important;
    border-bottom-color: #444 !important;
}

html.dark-mode .folder-dialog-header h3 {
    color: #eee !important;
}

html.dark-mode .folder-dialog-close {
    color: #888 !important;
}

html.dark-mode .folder-dialog-close:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.1) !important;
}

html.dark-mode .folder-dialog-body label {
    color: #ccc !important;
}

html.dark-mode .folder-dialog-body input[type="text"] {
    background: #333 !important;
    border-color: #444 !important;
    color: #eee !important;
}

html.dark-mode .folder-dialog-body input[type="text"]:focus {
    border-color: var(--primary-color, #666) !important;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1) !important;
}

html.dark-mode .folder-dialog-footer {
    background: #222 !important;
    border-top-color: #444 !important;
}

html.dark-mode .folder-dialog-cancel {
    background: #444 !important;
    color: #ddd !important;
}

html.dark-mode .folder-dialog-cancel:hover {
    background: #555 !important;
}

/* Folder Dialog con iframe */
.folder-dialog-iframe-content {
    max-width: 600px !important;
    width: 95% !important;
    max-height: 90vh !important;
}

.folder-dialog-iframe-body {
    padding: 0 !important;
    position: relative !important;
    min-height: 400px !important;
    max-height: 70vh !important;
    overflow: hidden !important;
}

.folder-dialog-loading {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    font-size: 14px !important;
    color: #666 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 10px !important;
    z-index: 10 !important;
}

.folder-dialog-loading .loading-spinner {
    width: 32px !important;
    height: 32px !important;
    border: 3px solid #e0e0e0 !important;
    border-top-color: var(--primary-color, #000) !important;
    border-radius: 50% !important;
    animation: spin 0.8s linear infinite !important;
}

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

.folder-dialog-iframe {
    width: 100% !important;
    height: 400px !important;
    min-height: 400px !important;
    border: none !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
}

/* Dark mode iframe */
html.dark-mode .folder-dialog-loading {
    color: #aaa !important;
}

/* ===========================================
   FOLDERLIST - Elenco cartelle
   =========================================== */

/* Rimuovi tutti i bordi dalle cartelle */
#mailboxlist li,
#mailboxlist li.mailbox,
.folderlist li,
.mailbox-dropdown-container,
.mailbox-dropdown-content li,
#favorites-dropdown,
#favorites-dropdown li {
    border: none !important;
    border-top: none !important;
    border-bottom: none !important;
    border-left: none !important;
    border-right: none !important;
}

.folderlist li a {
    padding: 8px 12px;
    border-radius: 6px;
    margin: 2px 8px;
    transition: all 0.15s ease;
    border: none !important;
}

.folderlist li a:hover {
    background: rgba(0, 0, 0, 0.05) !important;
}

.folderlist li a:hover:before {
    color: var(--primary-color, #000000) !important;
}

/* Cartella selezionata */
.folderlist li.selected > a,
.folderlist li a.selected {
    background: rgba(0, 0, 0, 0.08) !important;
    font-weight: 500;
}

.folderlist li.selected > a:before,
.folderlist li a.selected:before {
    color: var(--primary-color, #000000) !important;
}

/* Badge conteggio non letti - solo testo */
.folderlist li a .unreadcount {
    background: transparent !important;
    color: #333 !important;
    border-radius: 0;
    padding: 0;
    font-size: 14px;
    font-weight: 500;
    min-width: auto;
    text-align: right;
    position: absolute !important;
    right: 12px !important;
    top: 10px !important;
    transform: none !important;
    line-height: 1 !important;
}

/* ===========================================
   TREELIST - Lista ad albero generica
   =========================================== */
.treelist li.selected > a,
.treelist li.selected > div > a,
.treelist li.selected > div,
ul.treelist li.selected > a {
    background-color: rgba(0, 0, 0, 0.08) !important;
}

.treelist li.selected {
    border-left: 3px solid var(--primary-color, #000000) !important;
}

.treelist li.selected > a,
.treelist li.selected > div > a {
    color: var(--primary-color, #000000) !important;
}

/* ===========================================
   LISTING GENERICA
   =========================================== */
.listing li.selected > a,
.listing tr.selected td {
    background-color: rgba(0, 0, 0, 0.06) !important;
}

.listing li > div a.quickview:before,
.listing li > div a.quickview:hover:before {
    color: var(--primary-color, #000000) !important;
}

/* ===========================================
   SIDEBAR HEADER
   =========================================== */
#layout-sidebar .header {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

#layout-sidebar .header .header-title {
    font-weight: 600;
    color: #333;
}

/* ===========================================
   QUOTA DISPLAY
   =========================================== */
#layout-sidebar .footer .quota-widget {
    padding: 8px 16px;
    font-size: 12px;
    color: #666;
}

.quota-widget .bar {
    background: #ddd;
    border-radius: 4px;
    overflow: hidden;
    height: 4px;
    margin-top: 4px;
}

.quota-widget .bar .value {
    background: var(--primary-color, #000000);
    height: 100%;
    transition: width 0.3s ease;
}

/* Quota alta (> 80%) */
.quota-widget.warning .bar .value {
    background: #FFC107 !important;
}

/* Quota critica (> 95%) */
.quota-widget.critical .bar .value {
    background: #DC3545 !important;
}

/* ===========================================
   DARK MODE
   =========================================== */
html.dark-mode #layout-sidebar {
    background-color: #1a1a1a !important;
}

html.dark-mode .folderlist li a:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

html.dark-mode .folderlist li.selected > a {
    background: rgba(255, 255, 255, 0.1) !important;
}

html.dark-mode #layout-sidebar .header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

html.dark-mode #layout-sidebar .header .header-title {
    color: #eee;
}

/* ===========================================
   OVERRIDE GLOBALE - Cartelle selezionate con colore primario
   =========================================== */

/* Tutte le cartelle selezionate - sfondo colore primario */
#mailboxlist li.selected > a,
#mailboxlist li.mailbox.selected > a,
#mailboxlist ul li.selected > a,
.mailbox-dropdown-content li.selected > a,
.my-folders-content li.selected > a {
    background: var(--primary-color, #000) !important;
    color: #fff !important;
}

/* Tutte le icone delle cartelle selezionate - bianche */
#mailboxlist li.selected > a:before,
#mailboxlist li.mailbox.selected > a:before,
#mailboxlist ul li.selected > a:before,
.mailbox-dropdown-content li.selected > a:before,
.my-folders-content li.selected > a:before {
    filter: brightness(0) invert(1) !important;
}

/* Tre puntini bianchi per cartelle selezionate - FORZA colore bianco */
#mailboxlist li.selected > span.folder-actions-btn,
#mailboxlist li.mailbox.selected > span.folder-actions-btn,
#mailboxlist ul li.selected > span.folder-actions-btn,
.mailbox-dropdown-content li.selected > span.folder-actions-btn,
.mailbox-dropdown-content li.mailbox.selected > span.folder-actions-btn,
.mailbox-dropdown-content > li.mailbox.selected > span.folder-actions-btn,
.mailbox-dropdown-content > li.mailbox > ul > li.selected > span.folder-actions-btn,
.my-folders-content li.selected > span.folder-actions-btn,
li.mailbox.selected > span.folder-actions-btn {
    color: #fff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#mailboxlist li.selected > span.folder-actions-btn:hover,
#mailboxlist li.mailbox.selected > span.folder-actions-btn:hover,
#mailboxlist ul li.selected > span.folder-actions-btn:hover,
.mailbox-dropdown-content li.selected > span.folder-actions-btn:hover,
.mailbox-dropdown-content li.mailbox.selected > span.folder-actions-btn:hover,
.mailbox-dropdown-content > li.mailbox.selected > span.folder-actions-btn:hover,
.mailbox-dropdown-content > li.mailbox > ul > li.selected > span.folder-actions-btn:hover,
.my-folders-content li.selected > span.folder-actions-btn:hover,
li.mailbox.selected > span.folder-actions-btn:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
}

/* Badge unreadcount per cartelle selezionate - testo bianco, posizionato prima dei tre puntini */
#mailboxlist li.selected > a .unreadcount,
#mailboxlist li.mailbox.selected > a .unreadcount,
#mailboxlist ul li.selected > a .unreadcount,
.mailbox-dropdown-content li.selected > a .unreadcount,
.mailbox-dropdown-content li.mailbox.selected > a .unreadcount,
.mailbox-dropdown-content > li.mailbox.selected > a .unreadcount,
.mailbox-dropdown-content > li.mailbox > ul > li.selected > a .unreadcount,
.my-folders-content li.selected > a .unreadcount,
li.mailbox.selected > a .unreadcount {
    background: transparent !important;
    color: #fff !important;
    font-size: 15px !important;
    font-weight: 900 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    min-width: auto !important;
    text-align: right !important;
    right: 35px !important;
    top: 0px !important;
    transform: none !important;
    line-height: 1 !important;
}

/* Dark mode */
html.dark-mode #mailboxlist li.selected > a,
html.dark-mode #mailboxlist li.mailbox.selected > a,
html.dark-mode #mailboxlist ul li.selected > a,
html.dark-mode .mailbox-dropdown-content li.selected > a,
html.dark-mode .my-folders-content li.selected > a {
    background: var(--primary-color, #666) !important;
    color: #fff !important;
}

html.dark-mode #mailboxlist li.selected > a:before,
html.dark-mode #mailboxlist li.mailbox.selected > a:before,
html.dark-mode #mailboxlist ul li.selected > a:before,
html.dark-mode .mailbox-dropdown-content li.selected > a:before,
html.dark-mode .my-folders-content li.selected > a:before {
    filter: brightness(0) invert(1) !important;
}
