/* Content changes immediately; the short entrance is handled in app.js. */
/* One header geometry for every authenticated view, based on Panoramica.
   These layout properties override the older per-page header rules. */
html body[data-session="active"] { --header-height: 96px !important; }
html body[data-session="active"] #app-sidebar.app-header {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) !important;
  align-items: center;
  gap: 0 !important;
  top: 0;
  height: var(--header-height) !important;
  min-height: var(--header-height) !important;
  padding: 0 56px !important;
}
html body[data-session="active"] #app-sidebar .main-nav {
  position: relative !important;
  inset: auto !important;
  justify-self: center;
  width: max-content !important;
  height: 40px !important;
  min-height: 40px !important;
  gap: 2px !important;
  margin: 0 !important;
  transform: none !important;
}
html body[data-session="active"] #app-sidebar .nav-item {
  width: auto !important;
  min-width: 0 !important;
  height: 40px !important;
  min-height: 40px !important;
  padding: 0 14px !important;
}
html body[data-session="active"] #app-sidebar .sidebar-head { justify-self: start; min-width: 0; }
html body[data-session="active"] #app-sidebar .account-menu-wrap { justify-self: end; }
html body[data-session="active"] .app-content { padding-top: var(--header-height); }
@media (max-width: 900px) {
  html body[data-session="active"] { --header-height: 72px !important; }
  html body[data-session="active"] #app-sidebar.app-header { padding-inline: 20px !important; }
}
@media (max-width: 860px) {
  html body[data-session="active"] #app-sidebar.app-header {
    grid-template-columns: auto minmax(0, 1fr) auto !important;
    gap: 8px !important;
  }
  html body[data-session="active"] #app-sidebar .account-menu { display: inline-flex !important; width: 32px !important; height: 32px !important; min-height: 32px !important; padding: 0 !important; }
  html body[data-session="active"] #app-sidebar .account-menu-wrap { width: 32px; height: 32px; }
  html body[data-session="active"] #app-sidebar .account-copy { display: none !important; }
  html body[data-session="active"] #app-sidebar .brand { gap: 10px !important; }
  html body[data-session="active"] #app-sidebar .brand-word { display: block !important; }
  html body[data-session="active"] #app-sidebar .brand-mark { width: 30px !important; height: 30px !important; }
  html body[data-session="active"] #app-sidebar .nav-item { min-width: 44px !important; }
}
@media (max-width: 380px) {
  html body[data-session="active"] #app-sidebar .brand-word { display: none !important; }
}
html .app-main > .view.is-active { animation: none; }
html body .app-header .nav-indicator {
  transition: transform 160ms cubic-bezier(.2, .7, .3, 1),
    width 160ms cubic-bezier(.2, .7, .3, 1),
    height 160ms cubic-bezier(.2, .7, .3, 1), opacity 100ms ease;
}
html body #view-settings .settings-tab {
  transition: color 120ms ease, background-color 120ms ease, border-color 120ms ease;
}
@media (prefers-reduced-motion: reduce) {
  html body .app-header .nav-indicator,
  html body #view-settings .settings-tab { transition: none; }
}

/* Impostazioni con servizi da collegare: pallino rosso agganciato alla fine
   della scritta, appena sopra la sua riga. */
html body #app-sidebar .nav-item[data-view="settings"].has-missing-services .nav-copy { position: relative; }
html body #app-sidebar .nav-item[data-view="settings"].has-missing-services .nav-copy::after { content: ""; position: absolute; top: -3px; right: -9px; width: 7px; height: 7px; background: #d9534f; border-radius: 50%; box-shadow: 0 0 0 2px #fff; pointer-events: none; }

/* Blocco account in alto a destra, sui token del sito. Le regole storiche in
   theme-premium.css (avatar bianco, ruolo in verde lime) passano attraverso
   :has(#view-analysis...) e battono per specificita' quelle nuove: qui si
   aggancia a #company-account / #account-panel per chiudere la partita. */
html body #app-sidebar #company-account {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  padding: 4px 12px 4px 4px;
  color: var(--navy);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  box-shadow: none;
  transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}
html body #app-sidebar #company-account:not(:disabled):hover { background: rgba(11, 31, 58, .05); }
html body #app-sidebar #company-account[aria-expanded="true"] {
  background: var(--white, #fff);
  border-color: var(--line);
  box-shadow: var(--shadow-card);
}
html body #app-sidebar #company-account:focus-visible {
  outline: 2px solid var(--emerald-dark);
  outline-offset: 2px;
}
html body #app-sidebar #company-account > .ui-icon { display: none; }
html body #app-sidebar #company-account .account-avatar,
html body #account-panel .account-avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--emerald-dark);
  background: var(--emerald-soft);
  border: 1px solid var(--emerald-border);
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: .02em;
}
html body #app-sidebar #company-account .account-copy { text-align: left; }
html body #app-sidebar #company-account .account-copy strong {
  color: var(--navy);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.25;
}
html body #app-sidebar #company-account .account-copy small {
  margin-top: 1px;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.25;
}
@media (max-width: 860px) {
  html body #app-sidebar #company-account .account-avatar { width: 32px; height: 32px; }
}

/* Il menu che si apre: stessa superficie delle card, niente lime. */
html body #account-panel {
  top: calc(100% + 8px);
  padding: 6px;
  color: var(--navy);
  background: var(--white, #fff);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-float);
}
html body #account-panel .account-panel-head {
  grid-template-columns: 34px minmax(0, 1fr);
  margin: 0 0 4px;
  padding: 10px 10px 12px;
  border-bottom: 1px solid var(--line-soft);
}
html body #account-panel .account-panel-head .section-code {
  margin: 0 0 2px;
  color: var(--grey);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .08em;
}
html body #account-panel .account-panel-head strong { color: var(--navy); font-size: 13.5px; font-weight: 600; }
html body #account-panel .account-panel-head small { color: var(--muted); font-size: 12px; }
html body #account-panel .account-panel-actions button {
  color: var(--navy);
  border-radius: var(--radius-sm);
}
html body #account-panel .account-panel-actions button:hover,
html body #account-panel .account-panel-actions button:focus-visible {
  background: rgba(11, 31, 58, .05);
}
html body #account-panel .account-panel-actions b { color: var(--navy); font-weight: 600; }
html body #account-panel .account-panel-actions small { color: var(--muted); }
html body #account-panel .account-panel-icon {
  color: var(--emerald-dark);
  background: var(--emerald-soft);
  border: 1px solid var(--emerald-border);
  border-radius: var(--radius-sm);
}
html body #account-panel [data-account-action="logout"] .account-panel-icon {
  color: var(--muted);
  background: var(--surface-subtle);
  border-color: var(--line);
}
/* Nessun velo sulla pagina a menu aperto: la barra restava sopra e sembrava
   accendersi di bianco. Il menu si chiude comunque cliccando fuori. */
html body.account-open::before { display: none; }
