/* =====================================================================
 * EasySW – Shell del portale (header, menu laterale, dock mobile, notifiche)
 * I colori della società (tabella company.colori) sovrascrivono le
 * variabili --esw-brand / --esw-brand-logo / --esw-menu-text da menu.js
 * ===================================================================== */
:root {
    --esw-brand: #17302a;          /* header (colori.header) */
    --esw-brand-logo: rgba(0, 0, 0, .22); /* area logo (colori.logo) */
    --esw-on-brand: #ffffff;       /* testo/icone sul header, calcolato da menu.js */
    --esw-on-brand-soft: rgba(255, 255, 255, .14);
    --esw-accent: #a3cd44;         /* verde EasySW */
    --esw-accent-ink: #4d6b12;     /* accento leggibile su fondo chiaro */
    --esw-on-accent: #1d2a07;      /* testo sopra l'accento (colori.accent, rev. 18/10/2026) */
    --esw-ink: #1c2421;
    --esw-muted: #66736e;
    --esw-rail: #f4f6f3;
    --esw-surface: #ffffff;
    --esw-line: #e1e6e2;
    --esw-hover: #e8eee7;
    --esw-alert: #e5484d;
    --esw-menu-text: #3f4d48;      /* colori.textmenu */
    --esw-header-h: 56px;
    --esw-dock-h: 62px;
    --esw-font: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --esw-radius: 10px;
}

/* ------------------------------------------------------------------ HEADER */
.esw-header {
    height: var(--esw-header-h);
    background: var(--esw-brand) !important;
    color: var(--esw-on-brand);
    font-family: var(--esw-font);
    z-index: 1030;
    box-shadow: 0 1px 0 rgba(0, 0, 0, .08), 0 6px 18px -12px rgba(0, 0, 0, .45);
}
.esw-header .esw-brand {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px !important;
    background: var(--esw-brand-logo) !important;
    box-shadow: none;
}
.esw-header .esw-brand .logo {
    max-height: calc(var(--esw-header-h) - 14px);
    max-width: 100%;
    object-fit: contain;
}
/* logo nell'header: grande e/o con il nome accanto (rev. 17/10/2026, opzioni in gestionecompany/) */
.esw-header .esw-brand.is-big { padding-top: 3px !important; padding-bottom: 3px !important; }
.esw-header .esw-brand.is-big .logo { max-height: calc(var(--esw-header-h) - 6px); }
.esw-header .esw-brand.has-name { gap: 10px; min-width: 0; }
.esw-header .esw-brand.has-name .logo { flex: none; max-width: 44%; max-height: calc(var(--esw-header-h) - 12px); }
.esw-header .esw-brand.has-name.is-big .logo { max-height: calc(var(--esw-header-h) - 6px); }
.esw-brand-name {
    min-width: 0;
    font-family: var(--esw-brand-font, var(--esw-font));
    color: var(--esw-brand-ink, var(--esw-on-brand));
    font-size: 15px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: .005em;
    white-space: normal;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.esw-brand-name[hidden] { display: none; }
.esw-header .esw-brand.has-name { justify-content: center; }
.esw-header .esw-brand.al-sinistra { justify-content: flex-start; }
.esw-header .esw-brand.al-destra { justify-content: flex-end; }
@media (max-width: 767.98px) {
    /* su smartphone resta solo il logo (più grande): il nome toglierebbe spazio ai pulsanti */
    .esw-header .esw-brand.has-name .esw-brand-name { display: none; }
    .esw-header .esw-brand.has-name .logo { max-width: 100%; }
}
.esw-bar {
    flex: 1;
    min-width: 0;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px 0 8px;
}
.esw-context {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    padding-left: 4px;
}
.esw-context .esw-company {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.esw-context .esw-page {
    font-size: 12px;
    opacity: .72;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.esw-context .esw-page:empty { display: none; }
.esw-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.esw-icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--esw-on-brand);
    font-size: 17px;
    text-decoration: none;
    transition: background-color .15s ease;
}
.esw-icon-btn:hover,
.esw-icon-btn:focus-visible { background: var(--esw-on-brand-soft); color: var(--esw-on-brand); }
.esw-icon-btn:focus-visible,
.esw-user-btn:focus-visible,
.esw-dock-btn:focus-visible { outline: 2px solid var(--esw-accent); outline-offset: 2px; }
.esw-icon-btn.hide { display: none !important; }

/* campanella: dondola solo quando arrivano notifiche nuove */
.esw-bell-ico { display: inline-flex; transform-origin: 50% 2px; }
.esw-bell.is-ringing .esw-bell-ico { animation: esw-ring 1.1s ease-in-out 2; }
@keyframes esw-ring {
    0%, 100% { transform: rotate(0); }
    15% { transform: rotate(16deg); }
    30% { transform: rotate(-14deg); }
    45% { transform: rotate(10deg); }
    60% { transform: rotate(-6deg); }
    75% { transform: rotate(3deg); }
}
.esw-badge {
    position: absolute;
    top: 3px;
    right: 1px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--esw-alert);
    color: #fff;
    font: 700 11px/18px var(--esw-font);
    text-align: center;
    box-shadow: 0 0 0 2px var(--esw-brand);
}
.esw-badge.hide { display: none; }

/* utente */
.esw-user { position: relative; margin-left: 4px; }
.esw-user-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 10px 0 4px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--esw-on-brand);
    font: 600 13px var(--esw-font);
}
.esw-user-btn:hover { background: var(--esw-on-brand-soft); }
.esw-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--esw-accent);
    color: var(--esw-on-accent);
    font: 700 12px var(--esw-font);
    letter-spacing: .02em;
}
.esw-avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.esw-user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 260px;
    padding: 6px;
    border: 1px solid var(--esw-line);
    border-radius: 14px;
    background: var(--esw-surface);
    color: var(--esw-ink);
    box-shadow: 0 18px 40px -16px rgba(16, 24, 20, .35);
    font-family: var(--esw-font);
    z-index: 1060;
}
.esw-user-menu[hidden] { display: none; }
.esw-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px 12px;
    border-bottom: 1px solid var(--esw-line);
    margin-bottom: 4px;
}
.esw-user-card b { display: block; font-size: 14px; }
.esw-user-card small { display: block; color: var(--esw-muted); font-size: 12px; word-break: break-all; }
.esw-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--esw-ink);
    font-size: 14px;
    text-align: left;
    text-decoration: none;
}
.esw-menu-item:hover { background: var(--esw-rail); color: var(--esw-ink); }
.esw-menu-item .svg-inline--fa, .esw-menu-item i { width: 16px; color: var(--esw-muted); }
.esw-menu-item.danger, .esw-menu-item.danger .svg-inline--fa { color: #b42318; }
.esw-menu-item.hide { display: none; }

/* --------------------------------------------------------------- SIDEBAR */
.esw-sidebar {
    background: var(--esw-rail);
    border-right: 1px solid var(--esw-line);
    font-family: var(--esw-font);
}
@media (min-width: 768px) {
    .esw-sidebar {
        position: sticky;
        top: var(--esw-header-h);
        align-self: flex-start;
        height: calc(100vh - var(--esw-header-h));
        height: calc(100dvh - var(--esw-header-h));
    }
    .esw-sidebar .offcanvas-md { height: 100%; }
    .esw-sidebar .esw-side-body { height: 100%; }
    /* menu compresso (cookie easySwMenu): vedi "COLONNA DI ICONE" in fondo al file */
}
@media (max-width: 767.98px) {
    .esw-sidebar { border: 0; background: transparent; }
}
.esw-sidebar .offcanvas-md { background: var(--esw-rail); }
.esw-oc-head {
    background: var(--esw-brand);
    color: var(--esw-on-brand);
    padding: 14px 16px;
}
.esw-oc-head h5 { margin: 0; font: 700 16px var(--esw-font); }
.esw-oc-head .btn-close { filter: invert(1) grayscale(1) brightness(2); opacity: .8; }
.esw-side-body {
    display: flex;
    flex-direction: column;
    padding: 12px 10px 0 !important;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.esw-search {
    position: relative;
    margin: 2px 2px 10px;
}
.esw-search .svg-inline--fa, .esw-search > i {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--esw-muted);
    font-size: 13px;
    pointer-events: none;
}
.esw-search input {
    width: 100%;
    height: 36px;
    padding: 0 10px 0 32px;
    border: 1px solid var(--esw-line);
    border-radius: 9px;
    background: var(--esw-surface);
    color: var(--esw-ink);
    font: 14px var(--esw-font);
}
.esw-search input:focus { outline: none; border-color: var(--esw-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--esw-accent) 25%, transparent); }

.esw-link,
.esw-sidebar .menu-link.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 8px;
    color: var(--esw-menu-text);
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.25;
    text-decoration: none;
}
.esw-link .svg-inline--fa, .esw-link > i { width: 16px; flex: none; color: var(--esw-muted); }
.esw-link:hover, .esw-sidebar .menu-link.nav-link:hover { background: var(--esw-hover); color: var(--esw-ink); }
.esw-link.active, .esw-sidebar .menu-link.nav-link.active {
    background: var(--esw-surface);
    color: var(--esw-ink);
    font-weight: 700;
    box-shadow: 0 1px 2px rgba(16, 24, 20, .08), inset 3px 0 0 var(--esw-accent);
}
.esw-link.active .svg-inline--fa { color: var(--esw-accent-ink); }

.esw-group { margin-top: 4px; }
.esw-group-head {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--esw-ink);
    font: 700 13px var(--esw-font);
    text-align: left;
}
.esw-group-head:hover { background: var(--esw-hover); }
.esw-group-head .esw-group-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.esw-group-count {
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--esw-surface);
    color: var(--esw-muted);
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    border: 1px solid var(--esw-line);
}
.esw-chev { display: inline-flex; color: var(--esw-muted); font-size: 11px; transition: transform .2s ease; }
.esw-group.open .esw-chev { transform: rotate(90deg); }
.esw-group.has-active > .esw-group-head .esw-group-name::after {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-left: 7px;
    border-radius: 50%;
    background: var(--esw-accent);
    vertical-align: middle;
}
/* apertura gruppi senza Bootstrap collapse (evita conflitti col doppio bundle) */
.esw-sub {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .22s ease;
}
.esw-sub > ul { overflow: hidden; min-height: 0; margin: 0; padding: 0 0 0 10px; }
.esw-group.open > .esw-sub { grid-template-rows: 1fr; }
.esw-group.open > .esw-sub > ul { padding-bottom: 6px; }
.esw-sub ul { border-left: 1px solid var(--esw-line); margin-left: 17px !important; padding-left: 6px !important; }
.esw-sub .nav-item.esw-filtered { display: none; }
.esw-group.esw-filtered { display: none; }
.esw-empty { padding: 14px 10px; color: var(--esw-muted); font-size: 13px; }
.esw-empty.hide { display: none; }
.esw-side-foot {
    position: sticky;
    bottom: 0;
    margin-top: auto;
    padding: 10px 2px 12px;
    background: linear-gradient(to bottom, rgba(244, 246, 243, 0), var(--esw-rail) 30%);
}
.esw-side-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 10px;
    border: 1px solid var(--esw-line);
    background: var(--esw-surface);
    color: var(--esw-ink);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}
.esw-side-user:hover { border-color: var(--esw-accent); color: var(--esw-ink); }
.esw-side-user .esw-side-user-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 767.98px) {
    #sidebarMenu.offcanvas-md { width: min(86vw, 340px); }
    .esw-side-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
}

/* ------------------------------------------------------------ DOCK MOBILE */
.esw-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1035;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: calc(var(--esw-dock-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--esw-surface);
    border-top: 1px solid var(--esw-line);
    box-shadow: 0 -8px 24px -18px rgba(16, 24, 20, .5);
    font-family: var(--esw-font);
}
.esw-dock-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 0;
    background: none;
    color: var(--esw-muted);
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}
.esw-dock-btn .esw-dock-ico { position: relative; display: inline-flex; font-size: 19px; }
.esw-dock-btn.active { color: var(--esw-ink); }
.esw-dock-btn.active .esw-dock-ico::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -7px;
    width: 18px;
    height: 3px;
    border-radius: 3px;
    background: var(--esw-accent);
    transform: translateX(-50%);
}
.esw-dock-btn:active { color: var(--esw-ink); }
.esw-dock-btn .esw-badge { top: -7px; right: -12px; box-shadow: 0 0 0 2px var(--esw-surface); }
@media (max-width: 767.98px) {
    body.esw-has-dock { padding-bottom: calc(var(--esw-dock-h) + env(safe-area-inset-bottom) + 8px); }
    body.esw-has-dock .bd-mode-toggle { display: none; }
    .esw-header { --esw-header-h: 54px; }
    .esw-header .esw-brand { width: auto !important; max-width: 42%; padding: 6px 10px !important; }
    .esw-bar { padding: 0 6px 0 2px; }
    .esw-hide-mobile { display: none !important; }
}
@media (min-width: 768px) {
    .esw-dock { display: none; }
}

/* ------------------------------------------------------ CENTRO NOTIFICHE */
.esw-notify {
    --bs-offcanvas-width: 420px;
    font-family: var(--esw-font);
    color: var(--esw-ink);
    background: var(--esw-surface);
}
@media (max-width: 575.98px) {
    .esw-notify { --bs-offcanvas-width: 100vw; }
}
.esw-notify-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 18px 18px 12px;
    padding-top: calc(18px + env(safe-area-inset-top));
}
.esw-notify-head h2 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.esw-notify-head p { margin: 2px 0 0; color: var(--esw-muted); font-size: 13px; }
.esw-notify-head .btn-close { margin-left: auto; margin-top: 4px; }
.esw-notify-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 18px 12px;
    border-bottom: 1px solid var(--esw-line);
}
.esw-seg {
    display: inline-flex;
    padding: 3px;
    border-radius: 9px;
    background: var(--esw-rail);
}
.esw-seg button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border: 0;
    border-radius: 7px;
    background: none;
    color: var(--esw-muted);
    font: 600 13px var(--esw-font);
}
.esw-seg button.active { background: var(--esw-surface); color: var(--esw-ink); box-shadow: 0 1px 2px rgba(16, 24, 20, .12); }
.esw-seg .esw-pill {
    min-width: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--esw-alert);
    color: #fff;
    font-size: 11px;
    line-height: 17px;
}
.esw-seg .esw-pill:empty { display: none; }
.esw-link-btn {
    border: 0;
    background: none;
    padding: 4px 2px;
    color: var(--esw-accent-ink);
    font: 600 13px var(--esw-font);
    white-space: nowrap;
}
.esw-link-btn:hover { text-decoration: underline; }
.esw-link-btn:disabled { color: var(--esw-muted); opacity: .6; text-decoration: none; }
.esw-link-btn.danger { color: #b42318; }

.esw-notify-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 6px 10px 16px; }
.esw-n-section {
    margin: 14px 8px 6px;
    color: var(--esw-muted);
    font-size: 12px;
    font-weight: 700;
}
.esw-n {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 4px;
    padding: 4px;
    border-radius: 12px;
    transition: background-color .15s ease, opacity .2s ease, transform .2s ease;
}
.esw-n:hover { background: var(--esw-rail); }
.esw-n.is-leaving { opacity: 0; transform: translateX(24px); }
.esw-n-main {
    flex: 1;
    min-width: 0;
    display: flex;
    gap: 12px;
    padding: 8px 6px;
    color: inherit;
    text-decoration: none;
}
.esw-n-main:hover { color: inherit; }
.esw-n-ico {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: var(--esw-rail);
    color: var(--esw-muted);
    font-size: 15px;
}
.esw-n.unread .esw-n-ico { background: color-mix(in srgb, var(--esw-accent) 22%, transparent); color: var(--esw-accent-ink); }
.esw-n-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.esw-n-msg { font-size: 14px; line-height: 1.35; color: var(--esw-muted); overflow-wrap: anywhere; }
.esw-n.unread .esw-n-msg { color: var(--esw-ink); font-weight: 600; }
.esw-n-meta { font-size: 12px; color: var(--esw-muted); }
.esw-n-acts { display: flex; flex-direction: column; align-items: center; gap: 2px; padding-top: 6px; }
.esw-n-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--esw-muted);
    font-size: 13px;
}
.esw-n-btn:hover { background: var(--esw-surface); color: var(--esw-ink); }
.esw-n-btn.del:hover { color: #b42318; }
.esw-n-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--esw-alert); }
@media (hover: hover) {
    .esw-n .esw-n-btn.del { opacity: 0; }
    .esw-n:hover .esw-n-btn.del, .esw-n-btn.del:focus-visible { opacity: 1; }
}
.esw-n-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 56px 24px;
    text-align: center;
    color: var(--esw-muted);
    font-size: 14px;
}
.esw-n-empty .esw-n-ico { width: 56px; height: 56px; border-radius: 16px; font-size: 22px; }
.esw-n-empty b { color: var(--esw-ink); font-size: 15px; }

.esw-notify-foot {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 18px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--esw-line);
    background: var(--esw-rail);
}
.esw-push {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--esw-ink);
}
.esw-push .esw-push-ico {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--esw-surface);
    color: var(--esw-muted);
}
.esw-push.ok .esw-push-ico { color: var(--esw-accent-ink); background: color-mix(in srgb, var(--esw-accent) 25%, transparent); }
.esw-push.warn .esw-push-ico { color: #b54708; background: #fef0c7; }
.esw-push span.txt { flex: 1; min-width: 0; line-height: 1.3; }
.esw-push .btn { font: 600 12px var(--esw-font); border-radius: 8px; white-space: nowrap; }
.esw-foot-row { display: flex; justify-content: space-between; }

@media (prefers-reduced-motion: reduce) {
    .esw-bell.is-ringing .esw-bell-ico { animation: none; }
    .esw-sub, .esw-chev, .esw-n { transition: none; }
}

/* menu utente: su mobile diventa un pannello sopra il dock */
@media (max-width: 767.98px) {
    .esw-user-menu {
        position: fixed;
        top: auto;
        left: 10px;
        right: 10px;
        bottom: calc(var(--esw-dock-h) + env(safe-area-inset-bottom) + 10px);
        width: auto;
        padding: 8px;
    }
    .esw-menu-item { padding: 12px 10px; font-size: 15px; }
}

/* avatar con foto profilo */
.esw-avatar.has-photo { background: var(--esw-rail); overflow: hidden; }
.esw-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.esw-avatar img.esw-fade { opacity: 0; transition: opacity .25s ease; }
.esw-avatar img.esw-fade.is-in { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .esw-avatar img.esw-fade { transition: none; } }


/* =====================================================================
 * COLONNA DI ICONE – menu compresso su desktop (rev. 17/10/2026)
 * Al passaggio del mouse (o al clic) su un gruppo si apre un riquadro
 * con le sue funzioni.
 * ===================================================================== */
.esw-tg-closed, .esw-rail-btn, .esw-fly-title, .esw-group-ico { display: none; }
.esw-tg-open, .esw-tg-closed { display: inline-flex; }
body.esw-side-collapsed .esw-tg-open, body:not(.esw-side-collapsed) .esw-tg-closed { display: none; }
@media (max-width: 767.98px) {
    .esw-tg-open { display: inline-flex !important; }
    .esw-tg-closed { display: none !important; }
}

@media (min-width: 768px) {
    .esw-sidebar { transition: flex-basis .18s ease, width .18s ease, max-width .18s ease; }

    body.esw-side-collapsed #menu-sidebar {
        z-index: 1035; /* il riquadro del gruppo resta sopra al contenuto */
        flex: 0 0 64px !important;
        width: 64px !important;
        max-width: 64px !important;
    }
    body.esw-side-collapsed .main-page {
        flex: 1 1 0 !important;
        width: auto !important;
        max-width: calc(100% - 64px) !important;
        margin-left: 0 !important;
    }
    body.esw-side-collapsed .esw-side-body { padding: 10px 8px 0 !important; align-items: center; overflow-x: hidden; }

    /* elementi nascosti nella colonna */
    body.esw-side-collapsed .esw-search,
    body.esw-side-collapsed .esw-group-name,
    body.esw-side-collapsed .esw-group-count,
    body.esw-side-collapsed .esw-chev,
    body.esw-side-collapsed #esw-menu-empty,
    body.esw-side-collapsed .esw-side-user-name,
    body.esw-side-collapsed .esw-side-user > :last-child { display: none !important; }

    /* pulsanti quadrati con sola icona */
    body.esw-side-collapsed .esw-rail-btn,
    body.esw-side-collapsed #esw-link-home,
    body.esw-side-collapsed .esw-group-head {
        display: inline-flex; align-items: center; justify-content: center;
        width: 44px; height: 44px; padding: 0; margin: 0 0 4px;
        border: 0; border-radius: 12px; background: none;
        color: var(--esw-menu-text); font-size: 0; position: relative;
    }
    body.esw-side-collapsed .esw-rail-btn { margin-bottom: 8px; color: var(--esw-muted); }
    body.esw-side-collapsed .esw-rail-btn .svg-inline--fa, body.esw-side-collapsed .esw-rail-btn i,
    body.esw-side-collapsed #esw-link-home .svg-inline--fa, body.esw-side-collapsed #esw-link-home i,
    body.esw-side-collapsed .esw-group-ico .svg-inline--fa, body.esw-side-collapsed .esw-group-ico i { font-size: 18px; width: 18px; color: inherit; }
    body.esw-side-collapsed .esw-group-ico { display: inline-flex; }
    body.esw-side-collapsed .esw-rail-btn:hover,
    body.esw-side-collapsed #esw-link-home:hover,
    body.esw-side-collapsed .esw-group-head:hover,
    body.esw-side-collapsed .esw-group.esw-fly > .esw-group-head { background: var(--esw-hover); color: var(--esw-ink); }
    body.esw-side-collapsed #esw-link-home.active,
    body.esw-side-collapsed .esw-group.has-active > .esw-group-head {
        background: var(--esw-surface); color: var(--esw-accent-ink);
        box-shadow: 0 1px 2px rgba(16, 24, 20, .1), inset 3px 0 0 var(--esw-accent);
    }
    body.esw-side-collapsed .esw-group.has-active > .esw-group-head .esw-group-name::after { display: none; }
    body.esw-side-collapsed .esw-group { margin: 0; }

    /* il sottomenu normale non si vede: si usa il riquadro laterale */
    body.esw-side-collapsed .esw-sub { display: none; }
    body.esw-side-collapsed .esw-group.esw-fly > .esw-sub {
        display: block; position: fixed; z-index: 1045;
        width: 270px; overflow-y: auto; overscroll-behavior: contain;
        padding: 6px; background: var(--esw-surface);
        border: 1px solid var(--esw-line); border-radius: 14px;
        box-shadow: 0 18px 40px -16px rgba(16, 24, 20, .4);
        animation: esw-fly-in .14s ease-out;
    }
    body.esw-side-collapsed .esw-group.esw-fly > .esw-sub > ul { border: 0; margin: 0 !important; padding: 0 !important; overflow: visible; }
    body.esw-side-collapsed .esw-fly-title {
        display: block; padding: 8px 10px 6px; font-weight: 800; font-size: 13px; color: var(--esw-ink);
        border-bottom: 1px solid var(--esw-line); margin-bottom: 4px;
    }
    /* ponte invisibile tra icona e riquadro: il mouse ci passa senza chiuderlo */
    body.esw-side-collapsed .esw-group.esw-fly > .esw-group-head::after {
        content: ""; position: absolute; left: 100%; top: -6px; width: 14px; height: calc(100% + 12px);
    }

    body.esw-side-collapsed .esw-side-foot { padding: 10px 0 12px; background: var(--esw-rail); }
    body.esw-side-collapsed .esw-side-user { padding: 6px; border: 0; background: none; justify-content: center; }
    body.esw-side-collapsed .esw-side-user .esw-avatar { width: 32px; height: 32px; }
}
@keyframes esw-fly-in { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
    .esw-sidebar { transition: none; }
    body.esw-side-collapsed .esw-group.esw-fly > .esw-sub { animation: none; }
}
