/* Pub layout: sidebar + colonna principale (stile admin-shell) */
body.pub-shell-layout {
  --pub-side-w: 280px;
  --pub-side-w-collapsed: 76px;
  --pub-topbar-h: 68px;
  --pub-current-side-w: var(--pub-side-w);
}

body.pub-shell-layout.pub-side-collapsed {
  --pub-current-side-w: var(--pub-side-w-collapsed);
}

@media (min-width: 960px) {
  html:has(body.pub-shell-layout),
  body.pub-shell-layout {
    overflow-x: clip;
    max-width: 100%;
  }
}

/* Evita micro-scroll orizzontale da header/tools troppo larghi su mobile */
@media (max-width: 979px) {
  html:has(body.pub-shell-layout),
  body.pub-shell-layout {
    overflow-x: clip;
    max-width: 100%;
  }
}

/* Header: senza nav desktop la griglia a 3 col metteva profilo al centro — forziamo flex come admin slim */
@media (min-width: 980px) {
  body.pub-shell-layout:not(.admin-area) .site-header .header-row {
    display: flex !important;
    justify-content: flex-start;
    align-items: center;
    gap: 0.75rem;
    min-height: var(--pub-topbar-h);
  }

  /* Senza .nav-desktop la grid a 3 col metteva .header-tools nella colonna centrale */
  body.pub-shell-layout:not(.admin-area) .site-header .header-tools {
    margin-left: auto;
  }
}

@media (max-width: 979px) {
  body.pub-shell-layout:not(.admin-area) .site-header {
    overflow-x: clip;
  }

  body.pub-shell-layout:not(.admin-area) .site-header .header-row {
    position: relative;
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-start;
    gap: 0.35rem;
    min-height: 68px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding-left: max(0.65rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.65rem, env(safe-area-inset-right, 0px));
    overflow: visible;
  }

  /* DOM: brand → menu → tools; ordine visuale: brand | tools | menu */
  body.pub-shell-layout:not(.admin-area) .site-header .brand.brand--shell-mobile-only {
    order: 1;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 42%;
    padding-right: 0;
  }

  body.pub-shell-layout:not(.admin-area) .site-header .brand.brand--shell-mobile-only .brand-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.pub-shell-layout:not(.admin-area) .site-header .header-tools {
    order: 2;
    position: static !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    transform: none !important;
    margin-left: auto !important;
    margin-right: 0.15rem;
    width: auto;
    max-width: none;
    min-width: 0;
    flex: 0 1 auto;
    justify-content: flex-end;
    gap: 0.2rem;
    align-items: center;
    z-index: 2;
  }

  body.pub-shell-layout .pub-sidebar-open-header {
    order: 3;
    margin-left: 0 !important;
    flex-shrink: 0;
  }

  /* Su mobile stretto: solo crest + icone (niente nome) per evitare scroll orizzontale */
  body.pub-shell-layout:not(.admin-area) .site-header .header-tools .user-mini__text,
  body.pub-shell-layout:not(.admin-area) .site-header .header-tools .user-mini__main,
  body.pub-shell-layout:not(.admin-area) .site-header .user-mini .nm {
    display: none !important;
  }

  body.pub-shell-layout:not(.admin-area) .site-header .header-tools .user-mini {
    padding: 0.24rem 0.35rem;
    min-height: 32px;
    gap: 0;
  }

  body.pub-shell-layout:not(.admin-area) .site-header .header-tools .bell,
  body.pub-shell-layout:not(.admin-area) .site-header .header-tools .pub-chat-launch {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
  }
}

@media (max-width: 979px) and (min-width: 480px) {
  body.pub-shell-layout:not(.admin-area) .site-header .header-tools .user-mini__text {
    display: inline-flex !important;
    min-width: 0;
    max-width: 5.5rem;
  }

  body.pub-shell-layout:not(.admin-area) .site-header .header-tools .user-mini__main,
  body.pub-shell-layout:not(.admin-area) .site-header .user-mini .nm {
    display: inline !important;
    max-width: 5.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.78rem;
  }

  body.pub-shell-layout:not(.admin-area) .site-header .header-tools .user-mini {
    gap: 0.3rem;
    padding: 0.24rem 0.4rem;
  }
}

/* Menu laterale: bottone in header accanto al brand (mobile) */
body.pub-shell-layout .pub-sidebar-open-header {
  display: none !important;
}

body.pub-shell-layout .pub-sidebar-open-header__ico--desk {
  display: none !important;
}

body.pub-shell-layout .pub-sidebar-open-header__ico--mobile {
  display: inline-block !important;
}

@media (max-width: 979px) {
  body.pub-shell-layout .pub-sidebar-open-header {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 0;
    flex-shrink: 0;
    margin: 0 0 0 auto;
    padding: 0.44rem 0.56rem;
    border-radius: 12px;
    border: 1px solid rgba(56, 189, 248, 0.52);
    background: linear-gradient(165deg, rgba(24, 32, 52, 0.96), rgba(10, 14, 26, 0.98));
    color: #f1f5f9;
    font-weight: 900;
    font-size: 0.88rem;
    letter-spacing: 0.02em;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.2;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  }

  body.pub-shell-layout .pub-sidebar-open-header .pub-sidebar-open-header__text {
    display: none !important;
  }

  body.pub-shell-layout .pub-sidebar-open-header {
    position: relative;
    z-index: 3;
    flex-shrink: 0;
  }

  body.pub-shell-layout .pub-sidebar-open-header:hover {
    border-color: rgba(125, 211, 252, 0.55);
    color: #fff;
  }

  body.pub-shell-layout .pub-sidebar-open-header:focus-visible {
    outline: 2px solid rgba(56, 189, 248, 0.65);
    outline-offset: 2px;
  }

  body.pub-shell-layout .pub-sidebar-open-header i {
    font-size: 1.16rem;
    opacity: 1;
    filter: drop-shadow(0 0 8px rgba(34, 211, 238, 0.25));
  }
}

/* Colonna principale: larghezza sul contenitore (evita overflow da 100vw + scrollbar) */
@media (min-width: 960px) {
  body.pub-shell-layout #pub-sidebar .dlink--app-ml {
    display: none !important;
  }

  body.pub-shell-layout .pub-shell__main .container,
  body.pub-shell-layout .pub-shell__main > main.page-content.container {
    max-width: min(100%, 1420px);
    width: 100%;
    box-sizing: border-box;
  }
}

body.pub-shell-layout .nav-desktop {
  display: none !important;
}

@media (min-width: 960px) {
  body.pub-shell-layout .brand.brand--shell-mobile-only {
    display: none !important;
  }
}

body.pub-shell-layout .pub-shell {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  min-width: 0;
  max-width: 100%;
}

body.pub-shell-layout .pub-shell__main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
}

@media (min-width: 960px) {
  body.pub-shell-layout .pub-shell {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    min-height: 0;
  }

  /* Sidebar: full viewport */
  body.pub-shell-layout .pub-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--pub-current-side-w);
    height: 100dvh;
    max-height: 100dvh;
    min-height: 0;
    z-index: 1200;
    flex: none;
    align-self: auto;
    border-radius: 0;
    padding-bottom: 0;
    border-top: 0;
    border-left: 0;
    border-bottom: 0;
    transition: width 180ms ease;
  }

  /* Topbar: solo area principale */
  body.pub-shell-layout:not(.admin-area) .site-header {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--pub-current-side-w);
    width: auto;
    height: var(--pub-topbar-h);
    z-index: 1100;
    transition: left 180ms ease;
  }

  /* Desktop: niente linguetta MENU in topbar — toggle nella rail */
  body.pub-shell-layout:not(.admin-area) .pub-sidebar-open-header {
    display: none !important;
  }

  body.pub-shell-layout .pub-shell__main {
    flex: 1 1 auto;
    min-width: 0;
    box-sizing: border-box;
    width: calc(100% - var(--pub-current-side-w));
    max-width: calc(100% - var(--pub-current-side-w));
    min-height: 100dvh;
    margin-left: var(--pub-current-side-w);
    padding-top: var(--pub-topbar-h);
    display: flex;
    flex-direction: column;
    overflow-x: clip;
    transition: margin-left 180ms ease, width 180ms ease, max-width 180ms ease;
  }

  body.pub-shell-layout .pub-shell__main > .page-content {
    flex: 0 0 auto;
    width: 100%;
    max-width: min(100%, 1420px);
    margin-left: auto;
    margin-right: auto;
    min-height: 0;
    box-sizing: border-box;
  }

  body.pub-shell-layout .pub-shell__main > .site-footer {
    flex: 0 0 auto;
    width: 100%;
    max-width: min(100%, 1420px);
    margin-left: auto;
    margin-right: auto;
    margin-top: 28px;
    box-sizing: border-box;
  }

  body.pub-shell-layout .pub-side-backdrop {
    display: none !important;
  }
}

body.pub-shell-layout .pub-sidebar {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 0.65rem 0.5rem 1rem;
  border-radius: 0 16px 16px 0;
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-left: 0;
  background: linear-gradient(165deg, rgba(15, 23, 42, 0.94), rgba(2, 6, 23, 0.88));
  box-shadow: 4px 0 32px rgba(0, 0, 0, 0.35);
}

body.pub-shell-layout .pub-sidebar__nav {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.pub-shell-layout .pub-sidebar__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0.65rem 0.85rem;
  margin-bottom: 0.35rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

body.pub-shell-layout .pub-sidebar__head-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  min-width: 0;
  flex: 1 1 auto;
}

body.pub-shell-layout .pub-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: #f8fafc;
  min-width: 0;
  flex: 1 1 auto;
}

body.pub-shell-layout .pub-sidebar__collapse {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin-top: 0.15rem;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: rgba(8, 12, 26, 0.55);
  color: #bae6fd;
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

body.pub-shell-layout .pub-sidebar__collapse:hover {
  border-color: rgba(125, 211, 252, 0.55);
  background: rgba(14, 165, 233, 0.12);
  color: #e0f2fe;
}

body.pub-shell-layout .pub-sidebar__collapse:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.7);
  outline-offset: 2px;
}

body.pub-shell-layout .pub-sidebar__collapse i {
  font-size: 0.85rem;
}

/* Desktop: sidebar compatta (rail icone) invece di nascondere */
@media (min-width: 960px) {
  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .pub-sidebar {
    width: var(--pub-side-w-collapsed);
    padding: 0.45rem 0.3rem 0.35rem;
  }

  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .pub-sidebar__head {
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.15rem 0.55rem;
  }

  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .pub-sidebar__head-main {
    align-items: center;
    width: 100%;
  }

  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .pub-sidebar__brand {
    justify-content: center;
  }

  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .pub-sidebar__brand-text,
  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .xg-clock--side {
    display: none !important;
  }

  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .pub-sidebar__collapse {
    width: 2.25rem;
    height: 2.25rem;
    margin: 0.15rem auto 0;
  }

  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .pub-sidebar__collapse i {
    transform: rotate(180deg);
  }

  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .pub-sidebar .dlink,
  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .pub-sidebar .pub-sidebar__footer-link {
    justify-content: center;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
    font-size: 0;
    gap: 0;
    min-height: 42px;
  }

  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .pub-sidebar .dlink i,
  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .pub-sidebar .pub-sidebar__footer-link i {
    font-size: 1.05rem;
    margin: 0;
  }

  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .pub-sidebar .dlink.active::before {
    top: 4px;
    bottom: 4px;
  }

  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .pub-sidebar .pub-nav-badge,
  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .pub-sidebar .dlink__label,
  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .pub-sidebar .pub-sidebar__footer-label,
  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .pub-sidebar .accordion-caret,
  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .pub-sidebar .accordion-body,
  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .pub-sidebar .drawer-dd-hint,
  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .pub-sidebar .pub-nav-footer,
  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .pub-sidebar .pub-sidebar__online-compact-title,
  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .pub-sidebar .pub-sidebar__online-compact-body,
  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .pub-sidebar .pub-sidebar__online-compact-chev,
  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .pub-sidebar .muted {
    display: none !important;
  }

  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .pub-sidebar .accordion-btn {
    justify-content: center;
    padding: 0.5rem 0.2rem;
    font-size: 0;
  }

  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .pub-sidebar .accordion-btn > span:first-child {
    font-size: 0;
    margin: 0;
  }

  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .pub-sidebar .accordion-btn > span:first-child i {
    font-size: 1.05rem;
    margin-right: 0 !important;
  }

  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .pub-sidebar__online-compact {
    justify-content: center;
    align-items: center;
    padding: 0.45rem 0.2rem;
    min-height: 42px;
  }

  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .pub-sidebar__online-compact-head {
    justify-content: center;
    gap: 0;
  }

  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .pub-sidebar__online-compact-badge {
    display: inline-flex !important;
    position: static;
    margin: 0 0 0 0.2rem;
  }

  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden [data-sidebar-tip] {
    position: relative;
  }

  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden [data-sidebar-tip]:hover::after,
  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden [data-sidebar-tip]:focus-visible::after {
    content: attr(data-sidebar-tip);
    position: absolute;
    left: calc(100% + 0.45rem);
    top: 50%;
    transform: translateY(-50%);
    z-index: 1300;
    padding: 0.28rem 0.55rem;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #e2e8f0;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  }
}

body.pub-shell-layout .pub-sidebar__brand-ico img {
  display: block;
  width: 34px;
  height: 34px;
  max-width: 34px;
  max-height: 34px;
  border-radius: 8px;
  object-fit: contain;
}

body.pub-shell-layout .pub-sidebar__brand-title {
  display: block;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.02em;
}

body.pub-shell-layout .pub-sidebar__brand-sub {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(148, 163, 184, 0.95);
  margin-top: 0.12rem;
}

body.pub-shell-layout .pub-sidebar__nav .dlink,
body.pub-shell-layout .pub-sidebar__nav .accordion-btn {
  border-radius: 10px;
}

/* Utenti online — sotto i link Bug nel menu (non più in fondo sidebar) */
body.pub-shell-layout .pub-sidebar__nav .pub-sidebar__online {
  margin-top: 0.45rem;
  padding-top: 0;
  border-top: 0;
}

body.pub-shell-layout .pub-sidebar__online-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.55rem;
  padding: 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(226, 232, 240, 0.92);
}

body.pub-shell-layout .pub-sidebar__online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
  flex-shrink: 0;
}

body.pub-shell-layout .pub-sidebar__online-empty {
  margin: 0;
  padding: 0.45rem 0.4rem 0.15rem;
  font-size: 0.78rem;
  line-height: 1.35;
  color: rgba(148, 163, 184, 0.92);
}

body.pub-shell-layout .pub-sidebar__online-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

body.pub-shell-layout .pub-sidebar__online-item {
  margin: 0;
  padding: 0;
}

body.pub-shell-layout .pub-sidebar__online-card {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.55rem;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.22);
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.65), rgba(15, 23, 42, 0.5));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

body.pub-shell-layout .pub-sidebar__online-crest {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.6);
}

body.pub-shell-layout .pub-sidebar__online-crest img {
  display: block;
  width: 36px;
  height: 36px;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
}

body.pub-shell-layout .pub-sidebar__online-body {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

body.pub-shell-layout .pub-sidebar__online-name-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

body.pub-shell-layout .pub-sidebar__online-pf {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 0.95rem;
  line-height: 1;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.55);
  color: #e2e8f0;
}

body.pub-shell-layout .pub-sidebar__online-pf .fa-xbox {
  color: #107c10;
}

body.pub-shell-layout .pub-sidebar__online-pf .fa-playstation {
  color: #0070d1;
}

body.pub-shell-layout .pub-sidebar__online-pf-ea {
  font-size: 0.55rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #f8fafc;
}

body.pub-shell-layout .pub-sidebar__online-main {
  font-weight: 700;
  font-size: 0.88rem;
  line-height: 1.2;
  color: #f8fafc;
  word-break: break-word;
  min-width: 0;
}
body.pub-shell-layout .pub-sidebar__online-main-link {
  color: inherit;
  text-decoration: none;
}
body.pub-shell-layout .pub-sidebar__online-main-link:hover {
  text-decoration: underline;
}

body.pub-shell-layout .pub-sidebar__online-you {
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.12rem 0.35rem;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #7dd3fc;
}

body.pub-shell-layout .pub-sidebar__online-card--you {
  border-color: rgba(56, 189, 248, 0.38);
  background: linear-gradient(145deg, rgba(30, 58, 95, 0.55), rgba(15, 23, 42, 0.52));
}

body.pub-shell-layout .pub-sidebar__online-vf {
  flex-shrink: 0;
  color: #34d399;
  font-size: 0.8rem;
}

body.pub-shell-layout .pub-sidebar__online-sub {
  font-size: 0.72rem;
  line-height: 1.25;
  color: rgba(148, 163, 184, 0.95);
  padding-left: 0;
  word-break: break-word;
}
body.pub-shell-layout .pub-sidebar__online-team-link {
  color: #93c5fd;
  text-decoration: none;
}
body.pub-shell-layout .pub-sidebar__online-team-link:hover {
  text-decoration: underline;
}

body.pub-shell-layout .pub-sidebar__online-name-row:has(.pub-sidebar__online-pf) + .pub-sidebar__online-sub {
  padding-left: calc(1.5rem + 0.35rem);
}

@media (max-width: 959.98px) {
  body.pub-shell-layout:not(.admin-area) .site-header {
    position: sticky;
    top: 0;
    left: auto;
    right: auto;
    width: auto;
    height: auto;
  }

  body.pub-shell-layout .pub-shell__main {
    margin-left: 0;
    padding-top: 0;
    padding-left: max(0.65rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.65rem, env(safe-area-inset-right, 0px));
    width: 100%;
    max-width: 100%;
  }

  body.pub-shell-layout .pub-shell__main > .site-footer {
    margin-top: 28px;
  }

  body.pub-shell-layout .pub-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100dvh;
    max-height: 100dvh;
    width: min(var(--pub-side-w), 92vw);
    z-index: 1400;
    transform: translateX(-104%);
    transition: transform 0.28s ease;
    border-radius: 0 16px 16px 0;
    box-shadow: 12px 0 48px rgba(0, 0, 0, 0.55);
    padding-bottom: 0;
  }

  body.pub-shell-drawer-open {
    overflow: hidden;
  }

  body.pub-shell-layout .pub-shell.pub-shell--drawer-open .pub-sidebar {
    transform: translateX(0);
  }

  body.pub-shell-layout .pub-shell.pub-shell--drawer-open .pub-side-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1390;
    background: rgba(2, 6, 18, 0.62);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
  }
}

/*
 * Phone landscape: contenuto full-width (come menu chiuso).
 * Menu apre drawer overlay sopra il contenuto — non colonna dockata.
 */
@media (orientation: landscape) and (max-height: 520px) and (min-width: 600px) {
  body.pub-shell-layout #pub-sidebar .dlink--app-ml {
    display: none !important;
  }

  body.pub-shell-layout .brand.brand--shell-mobile-only {
    display: none !important;
  }

  body.pub-shell-layout .pub-shell {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    min-height: 0;
  }

  body.pub-shell-layout:not(.admin-area) .site-header {
    position: sticky;
    left: auto;
    right: auto;
    width: auto;
    height: auto;
  }

  body.pub-shell-layout .pub-shell__main {
    flex: 1 1 auto;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 0;
    margin-left: 0;
    padding-top: 0;
    display: flex;
    flex-direction: column;
  }

  body.pub-shell-layout .pub-shell__main > .page-content {
    flex: 0 0 auto;
    width: 100%;
  }

  body.pub-shell-layout .pub-shell__main > .site-footer {
    flex: 0 0 auto;
    margin-top: 28px;
  }

  /* Sidebar fuori flusso: overlay drawer */
  body.pub-shell-layout .pub-sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100dvh;
    max-height: 100dvh;
    width: min(280px, 78vw);
    z-index: 1400;
    transform: translateX(-104%);
    transition: transform 0.28s ease;
    flex: none;
    align-self: auto;
    min-height: 0;
    max-height: none;
    border-radius: 0 14px 14px 0;
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.55);
  }

  body.pub-shell-layout .pub-shell.pub-shell--drawer-open .pub-sidebar {
    transform: translateX(0);
  }

  body.pub-shell-layout .pub-shell.pub-shell--drawer-open .pub-side-backdrop {
    display: block !important;
    position: fixed;
    inset: 0;
    z-index: 1390;
    background: rgba(2, 6, 18, 0.55);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
  }

  body.pub-shell-layout .pub-side-backdrop {
    display: none;
  }

  /* Sempre “menu chiuso” nel layout: bottone Menu in header */
  body.pub-shell-layout .pub-sidebar-open-header,
  body.pub-shell-layout.pub-side-collapsed .pub-sidebar-open-header {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    flex-shrink: 0;
    margin: 0;
    padding: 0.36rem 0.6rem;
    border-radius: 10px;
    border: 1px solid rgba(56, 189, 248, 0.52);
    background: linear-gradient(165deg, rgba(24, 32, 52, 0.96), rgba(10, 14, 26, 0.98));
    color: #f1f5f9;
    font-weight: 900;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.2;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  }

  body.pub-shell-layout .pub-sidebar-open-header .pub-sidebar-open-header__text,
  body.pub-shell-layout.pub-side-collapsed .pub-sidebar-open-header .pub-sidebar-open-header__text {
    display: inline !important;
  }

  body.pub-shell-layout .pub-shell__main .container,
  body.pub-shell-layout .pub-shell__main > main.page-content.container {
    max-width: min(100%, 1420px);
    width: 100%;
    box-sizing: border-box;
  }
}

/* =============================================================================
   Premium refresh — stati visivi, zone scroll, utility, a11y
   ============================================================================= */
body.pub-shell-layout {
  --pub-side-accent: #22d3ee;
  --pub-side-active-bg: rgba(56, 189, 248, 0.11);
  --pub-side-active-border: rgba(56, 189, 248, 0.28);
  --pub-side-hover-bg: rgba(59, 130, 246, 0.09);
  --pub-side-open-bg: rgba(255, 255, 255, 0.055);
}

body.pub-shell-layout .pub-sidebar {
  background:
    linear-gradient(168deg, rgba(18, 28, 48, 0.97) 0%, rgba(8, 12, 24, 0.94) 55%, rgba(4, 8, 18, 0.92) 100%);
  border-color: rgba(56, 189, 248, 0.26);
  box-shadow:
    4px 0 36px rgba(0, 0, 0, 0.42),
    inset -1px 0 0 rgba(56, 189, 248, 0.08);
}

body.pub-shell-layout .pub-sidebar__head {
  flex-shrink: 0;
  border-bottom-color: rgba(148, 163, 184, 0.2);
}

body.pub-shell-layout .pub-nav-primary {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 0.15rem 0.2rem 0.35rem;
  scrollbar-gutter: stable;
}

body.pub-shell-layout .pub-nav-utility {
  flex-shrink: 0;
  margin-top: 0.35rem;
  padding: 0.65rem 0.2rem 0.35rem;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.35), rgba(15, 23, 42, 0.08));
}

body.pub-shell-layout .pub-nav-footer {
  flex-shrink: 0;
  padding: 0 0.2rem 0.15rem;
}

body.pub-shell-layout .pub-nav-footer hr {
  margin: 0.35rem 0.5rem 0.55rem;
  border: 0;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
}

body.pub-shell-layout #pub-sidebar .pub-sidebar__nav .dlink {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 42px;
  padding-left: 0.85rem;
}

body.pub-shell-layout #pub-sidebar .pub-sidebar__nav .dlink.active {
  color: #e0f2fe;
  background: var(--pub-side-active-bg);
  border-color: var(--pub-side-active-border);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

body.pub-shell-layout #pub-sidebar .pub-sidebar__nav .dlink.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--pub-side-accent);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.45);
}

body.pub-shell-layout #pub-sidebar .pub-sidebar__nav .dlink:hover:not(.disabled):not(.active) {
  background: var(--pub-side-hover-bg);
  border-color: rgba(59, 130, 246, 0.16);
}

body.pub-shell-layout #pub-sidebar .pub-sidebar__nav .dlink:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.55);
  outline-offset: 2px;
}

body.pub-shell-layout #pub-sidebar .accordion-section--manager .accordion-body .dlink--sub {
  min-height: 44px;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  padding-left: 1rem;
  font-size: 0.875rem;
}

body.pub-shell-layout #pub-sidebar .accordion-section[aria-expanded="true"] .accordion-btn {
  background: var(--pub-side-open-bg);
  border-color: rgba(148, 163, 184, 0.22);
  color: #f1f5f9;
}

body.pub-shell-layout #pub-sidebar .accordion-btn {
  width: 100%;
  min-height: 44px;
  margin: 0.2rem 0;
  padding: 0.55rem 0.75rem;
}

body.pub-shell-layout #pub-sidebar .accordion-btn:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.55);
  outline-offset: 2px;
}

body.pub-shell-layout #pub-sidebar .dlink--admin {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.45rem;
  margin: 0.35rem 0 0.15rem;
  text-align: left;
  font-weight: 650;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

body.pub-shell-layout #pub-sidebar .dlink--admin:not(.active):hover {
  background: var(--pub-side-hover-bg);
  border-color: rgba(59, 130, 246, 0.16);
  box-shadow: none;
}

body.pub-shell-layout #pub-sidebar .dlink--admin .dlink__label {
  flex: 1 1 auto;
}

body.pub-shell-layout .pub-nav-badge {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.14rem 0.42rem;
  border-radius: 999px;
  line-height: 1.2;
}

body.pub-shell-layout .pub-nav-badge--admin {
  color: #c4b5fd;
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(165, 180, 252, 0.35);
}

body.pub-shell-layout #pub-sidebar .dlink--admin.active .pub-nav-badge {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  body.pub-shell-layout #pub-sidebar .dlink,
  body.pub-shell-layout #pub-sidebar .accordion-btn,
  body.pub-shell-layout #pub-sidebar .accordion-caret {
    transition: none !important;
  }

  body.pub-shell-layout #pub-sidebar .dlink:hover:not(.disabled) {
    transform: none !important;
  }
}

/* Footer fisso, online compatto, pannello laterale */
body.pub-shell-layout .pub-sidebar {
  padding: 0.65rem 0.5rem 0;
}

body.pub-shell-layout .pub-sidebar__head {
  flex: 0 0 auto;
  margin-bottom: 0;
}

body.pub-shell-layout .pub-sidebar__footer {
  flex: 0 0 auto;
  position: relative;
  z-index: 2;
  padding: 0.55rem 0.35rem max(12px, env(safe-area-inset-bottom, 0px));
  background: rgba(7, 17, 33, 0.98);
  border-top: 1px solid rgba(55, 180, 225, 0.15);
}

body.pub-shell-layout #pub-sidebar .pub-sidebar__footer .dlink.active {
  color: #e0f2fe;
  background: var(--pub-side-active-bg);
  border-color: var(--pub-side-active-border);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

body.pub-shell-layout #pub-sidebar .pub-sidebar__footer .dlink:hover:not(.disabled):not(.active) {
  background: var(--pub-side-hover-bg);
  border-color: rgba(59, 130, 246, 0.16);
}

body.pub-shell-layout #pub-sidebar .pub-sidebar__footer .dlink:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.55);
  outline-offset: 2px;
}

/* Desktop: Cerca già in top bar (≥980px) — nascondi dal footer sidebar */
@media (min-width: 980px) {
  body.pub-shell-layout .pub-sidebar__footer-link--cerca {
    display: none !important;
  }
}

body.pub-shell-layout .pub-sidebar__footer-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 42px;
  padding-left: 0.85rem;
  margin: 0.12rem 0;
}

body.pub-shell-layout #pub-sidebar .pub-sidebar__footer .dlink.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--pub-side-accent, #22d3ee);
}

body.pub-shell-layout .pub-nav-primary {
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.35) transparent;
}

body.pub-shell-layout .pub-nav-primary::-webkit-scrollbar {
  width: 6px;
}

body.pub-shell-layout .pub-nav-primary::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.28);
  border-radius: 999px;
}

body.pub-shell-layout .pub-nav-primary::-webkit-scrollbar-track {
  background: transparent;
}

body.pub-shell-layout .pub-sidebar__online-compact {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  width: 100%;
  margin: 0.35rem 0 0;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.2);
  background: rgba(15, 23, 42, 0.55);
  color: #e2e8f0;
  text-align: left;
  cursor: pointer;
  font: inherit;
  position: relative;
}

body.pub-shell-layout .pub-sidebar__online-compact:hover {
  background: rgba(30, 41, 59, 0.72);
  border-color: rgba(56, 189, 248, 0.32);
}

body.pub-shell-layout .pub-sidebar__online-compact:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.55);
  outline-offset: 2px;
}

body.pub-shell-layout .pub-sidebar__online-compact-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

body.pub-shell-layout .pub-sidebar__online-compact-title {
  flex: 1 1 auto;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.95);
}

body.pub-shell-layout .pub-sidebar__online-compact-chev {
  opacity: 0.65;
  font-size: 0.72rem;
}

body.pub-shell-layout .pub-sidebar__online-compact-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

body.pub-shell-layout .pub-sidebar__online-compact-line {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  font-size: 0.78rem;
  line-height: 1.3;
  color: rgba(203, 213, 225, 0.95);
}

body.pub-shell-layout .pub-sidebar__online-compact-crest {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

body.pub-shell-layout .pub-sidebar__online-compact-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.pub-shell-layout .pub-sidebar__online-compact-team {
  color: #93c5fd;
}

body.pub-shell-layout .pub-sidebar__online-compact-more {
  font-size: 0.74rem;
  color: rgba(148, 163, 184, 0.95);
  padding-left: 0.1rem;
}

body.pub-shell-layout .pub-sidebar__online-compact-badge {
  display: none;
}

/* Pannello utenti online */
body.pub-shell-layout .pub-online-panel {
  position: fixed;
  inset: 0;
  z-index: 1500;
  pointer-events: none;
}

body.pub-shell-layout .pub-online-panel[aria-hidden="false"] {
  pointer-events: auto;
}

body.pub-shell-layout .pub-online-panel__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 18, 0.55);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  border: 0;
  padding: 0;
  cursor: pointer;
}

body.pub-shell-layout .pub-online-panel__sheet {
  position: absolute;
  top: 0;
  left: var(--pub-current-side-w);
  bottom: 0;
  width: min(360px, calc(100vw - var(--pub-current-side-w) - 1rem));
  display: flex;
  flex-direction: column;
  background: linear-gradient(168deg, rgba(15, 23, 42, 0.98), rgba(8, 12, 24, 0.96));
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-left: 0;
  box-shadow: 8px 0 40px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

body.pub-shell-layout.pub-side-collapsed .pub-online-panel__sheet {
  left: var(--pub-side-w-collapsed);
  width: min(360px, calc(100vw - var(--pub-side-w-collapsed) - 1rem));
}

body.pub-shell-layout .pub-online-panel__head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1rem 0.65rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

body.pub-shell-layout .pub-online-panel__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: #f8fafc;
}

body.pub-shell-layout .pub-online-panel__count {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: rgba(148, 163, 184, 0.95);
}

body.pub-shell-layout .pub-online-panel__close {
  flex-shrink: 0;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.75);
  color: #e2e8f0;
  cursor: pointer;
  display: grid;
  place-items: center;
}

body.pub-shell-layout .pub-online-panel__close:hover {
  border-color: rgba(56, 189, 248, 0.4);
  color: #7dd3fc;
}

body.pub-shell-layout .pub-online-panel__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0.65rem 0.75rem 1rem;
  -webkit-overflow-scrolling: touch;
}

body.pub-shell-layout .pub-online-panel__empty {
  margin: 0;
  padding: 0.5rem 0.25rem;
  font-size: 0.86rem;
  color: rgba(148, 163, 184, 0.95);
}

body.pub-shell-layout .pub-online-panel__list {
  gap: 0.5rem;
}

body.pub-shell-layout.pub-online-panel-open {
  overflow: hidden;
}

@media (max-width: 959.98px) {
  body.pub-shell-layout .pub-online-panel__sheet {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-height: min(85dvh, 100%);
    border-radius: 16px 16px 0 0;
    border-left: 1px solid rgba(56, 189, 248, 0.28);
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }
}

@media (min-width: 960px) {
  body.pub-shell-layout .pub-shell.pub-shell--sidebar-hidden .pub-sidebar__online-compact-badge {
    display: inline-flex !important;
  }
}
