.app-switcher { position: relative; display: none; }
.app-direct-nav { display: flex; align-items: center; gap: 2px; }
.app-direct-nav a { padding: 0 9px; color: var(--bd-muted); font-size: 11px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.app-direct-nav a:hover, .app-direct-nav a:focus-visible { color: var(--bd-ink); background: transparent; }
.app-direct-label { display: inline-block; padding: 10px 0 8px; border-bottom: 2px solid transparent; }
.app-direct-nav a[aria-current="page"] { color: var(--bd-ink); background: transparent; box-shadow: none; }
.app-direct-nav a[aria-current="page"] .app-direct-label { border-bottom-color: var(--bd-lime); }
.app-direct-nav a.unavailable { opacity: .45; }
.app-switcher-button { min-width: 132px; justify-content: space-between; }
.app-menu { position: absolute; z-index: 50; top: calc(100% + 8px); right: 0; width: 310px; padding: 10px; border: 1px solid var(--bd-border); border-radius: 13px; background: var(--bd-surface); box-shadow: 0 16px 40px rgb(16 24 40 / 16%); }
.app-menu[hidden] { display: none; }
.app-menu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.app-menu a { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 9px; padding: 9px; border-radius: 9px; color: var(--bd-ink); text-decoration: none; }
.app-menu a:hover, .app-menu a:focus-visible { background: var(--bd-soft); }
.app-menu a[aria-current="page"] { background: color-mix(in srgb, var(--bd-lime) 13%, var(--bd-surface)); }
.app-menu a.unavailable { opacity: .58; }
.app-glyph { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--bd-border); border-radius: 9px; background: var(--bd-surface-2); font-weight: 800; }
.app-label { display: grid; font-size: 12px; font-weight: 700; }
.app-label small { color: var(--bd-muted); font-size: 10px; font-weight: 500; }
.portal-topbar {
  height: auto !important;
  min-height: 92px;
  padding: 0 28px !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: 34px 58px;
  column-gap: 18px;
  align-items: stretch;
}
.topbar-primary-row {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  display: flex;
  align-items: end;
  padding-bottom: 3px;
}
.topbar-primary-row .crumb {
  min-width: 0;
  overflow: hidden;
  color: var(--bd-muted);
  font-size: 10px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-secondary-row {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}
.topbar-app-slot {
  min-width: 0;
  display: flex;
  align-items: center;
}
.topbar-feedback {
  min-width: 0;
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}
.topbar-feedback .command-trigger {
  width: clamp(220px, 24vw, 360px);
  margin-left: 0;
}
.topbar-feedback .shell-status {
  min-width: 150px;
  padding-left: 14px;
  border-left: 1px solid var(--bd-border);
}
.topbar-feedback .shell-status:only-child {
  min-width: 0;
  padding-left: 0;
  border-left: 0;
}
.topbar-utilities {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: stretch;
  padding-left: 18px;
  border-left: 1px solid var(--bd-border);
}
.topbar-cluster { display: flex; align-items: center; gap: 8px; }
.shell-status { max-width: 240px; color: var(--bd-muted); font-size: 11px; }
.preview-badge { padding: 4px 8px; border: 1px solid var(--bd-border); border-radius: 99px; background: color-mix(in srgb, var(--bd-lime) 12%, var(--bd-surface)); color: var(--bd-ink); font-size: 10px; font-weight: 700; }
.identity-button { display: flex; align-items: center; gap: 8px; padding: 5px 9px 5px 5px; border: 1px solid var(--bd-border); border-radius: 10px; background: var(--bd-surface); color: var(--bd-ink); }
.identity-avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--bd-lime); color: var(--bd-lime-ink); font-size: 11px; font-weight: 800; }
.shell-popover { position: absolute; z-index: 55; top: calc(100% + 8px); right: 0; width: 290px; padding: 15px; border: 1px solid var(--bd-border); border-radius: 12px; background: var(--bd-surface); color: var(--bd-ink); box-shadow: 0 16px 40px rgb(16 24 40 / 16%); }
.shell-popover[hidden] { display: none; }
.shell-popover strong { display: block; font-size: 13px; }
.shell-popover p { margin: 15px 0 3px; font-size: 13px; font-weight: 650; }
.shell-popover small { display: block; color: var(--bd-muted); font-size: 11px; line-height: 1.5; }
.profile-popover { width: 210px; padding: 7px; }
.profile-popover a, .profile-popover button { display: block; width: 100%; padding: 10px; border: 0; border-radius: 8px; background: transparent; color: var(--bd-ink); font: inherit; font-size: 12px; text-align: left; text-decoration: none; }
.profile-popover a:hover, .profile-popover button:hover { background: var(--bd-soft); }
@media (max-width: 1280px) {
  .app-direct-nav { display: none; }
  .app-switcher { display: block; }
  .topbar-feedback .command-trigger { width: clamp(190px, 22vw, 280px); }
}
@media (max-width: 760px) {
  .portal-topbar {
    min-height: 62px;
    padding: 0 14px !important;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: 62px;
    column-gap: 8px;
  }
  .portal-topbar .mobile-menu { grid-column: 1; grid-row: 1; align-self: center; }
  .topbar-primary-row, .topbar-feedback { display: none; }
  .topbar-secondary-row { grid-column: 2; grid-row: 1; align-self: center; }
  .topbar-utilities { grid-column: 3; grid-row: 1; align-self: center; padding-left: 0; border-left: 0; }
  .portal-topbar .crumb, .preview-badge, [data-help-link], .shell-status, .identity-button > span:last-child { display: none; }
  .topbar-utilities .icon-btn[aria-label="Notifiche"], .topbar-utilities [data-theme-toggle] { display: none; }
  .app-switcher-button { min-width: 62px; padding-inline: 11px; }
  .app-switcher-button span:first-child { font-size: 0; }
  .app-switcher-button span:first-child::after { content: 'App'; font-size: 12px; }
  .app-menu { position: fixed; top: 66px; right: 12px; left: 12px; width: auto; }
}
