/* r107 · caricamento progressivo, finestre e identità ambienti */
.mfa-card { max-height: min(92vh, 760px); overflow: auto; }
.mfa-setup { display: grid; justify-items: center; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #f7fafc; }
.mfa-qr svg { width: 190px; height: 190px; max-width: 100%; background: #fff; }
.mfa-setup code { max-width: 100%; padding: 8px 10px; border-radius: 8px; background: #e8f1f7; color: var(--navy); font-size: .875rem; font-weight: 850; letter-spacing: .08em; overflow-wrap: anywhere; }
.recovery-codes-dialog { width: min(620px, calc(100vw - 24px)); max-height: min(88vh, 760px); padding: 0; border: 0; border-radius: 18px; overflow: hidden; }
.recovery-codes-dialog .dialog-card { max-height: min(88vh, 760px); padding: 28px; overflow: auto; }
.recovery-codes-dialog .eyebrow { margin-top: 0; }
.recovery-codes-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 18px 0; }
.recovery-codes-list code { padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: #f7fafc; color: var(--navy); text-align: center; font-weight: 850; }
.recovery-code-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.recovery-code-tools button { min-height: 44px; }
.recovery-confirm { display: flex; align-items: center; gap: 10px; padding: 13px 14px; border: 1px solid #c9dce9; border-radius: 11px; background: #f3f8fc; }
.recovery-codes-dialog .dialog-actions { margin-top: 16px; }
.recovery-codes-dialog .dialog-actions .primary { width: 100%; min-height: 48px; }

.account-menu-button { appearance: none; display: grid; grid-template-columns: 36px minmax(0,1fr) 18px; align-items: center; gap: 9px; min-height: 48px; padding: 5px 9px; border: 1px solid #d6e3ed; border-radius: 12px; background: #fff; color: inherit; text-align: left; cursor: pointer; transition: border-color .18s,box-shadow .18s,background .18s; }
.account-menu-button:hover,.account-menu-button:focus-visible { border-color: #8db8d5; background: #f7fbfe; box-shadow: 0 5px 16px rgba(13,45,68,.12); }
.account-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #176bb8; color: #fff; font-size: .875rem; font-weight: 900; }
.account-summary { display: grid; min-width: 0; }
.account-summary small,.account-summary strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-chevron { color: #547084; font-size: 17px; transition: transform .18s; }
.account-menu-button[aria-expanded="true"] .account-chevron { transform: rotate(180deg); }
.refresh-icon { width: 44px; height: 44px; min-width: 44px; padding: 0; font-size: 23px; line-height: 1; }
.account-menu-dialog { width: min(430px, calc(100vw - 24px)); margin: 82px 20px auto auto; padding: 0; border: 0; border-radius: 18px; background: transparent; }
.account-menu-dialog::backdrop { background: rgba(9, 27, 43, .28); backdrop-filter: blur(2px); }
.account-menu-card { position: relative; padding: 22px; border-radius: 18px; background: #fff; box-shadow: 0 24px 70px rgba(13, 40, 62, .28); }
.account-menu-identity { display: grid; gap: 3px; padding: 2px 42px 16px 2px; border-bottom: 1px solid var(--line); }
.account-menu-identity small { color: var(--blue); font-size: .875rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.account-menu-identity strong { color: var(--navy); font-size: 18px; }
.account-menu-identity span { color: var(--muted); font-size: .875rem; }
.account-menu-actions { display: grid; gap: 8px; margin: 14px 0; }
.account-menu-actions .secondary { display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 10px; width: 100%; min-height: 58px; text-align: left; text-decoration: none; }
.account-menu-actions .secondary > span:first-child { font-size: 19px; text-align: center; }
.account-menu-actions .secondary > span:last-child { display: grid; gap: 2px; }
.account-menu-actions strong { color: var(--navy); font-size: .875rem; }
.account-menu-actions small { color: var(--muted); font-size: .875rem; }
.account-logout { width: 100%; min-height: 46px; border: 1px solid #efc2c5; border-radius: 10px; background: #fff5f5; color: #a1242c; font-weight: 850; cursor: pointer; }
#companyFilter { min-width: 190px; min-height: 44px; }
.mobile-company-switch { display: none; }
.mobile-company-symbol { font-size: .875rem; font-weight: 950; letter-spacing: -.04em; }
.mobile-company-chevron { margin-left: -2px; color: #60798b; font-size: .875rem; }
#totpSecurityCard { grid-column: 1 / -1; border-color: #acd9c2; background: #f3fbf7; }

.is-production .staging-banner { position: fixed; inset: 0 0 auto 0; height: calc(52px + var(--safe-top)); z-index: 2147483646; display: flex; align-items: center; justify-content: center; gap: 13px; padding: var(--safe-top) 18px 0; background: repeating-linear-gradient(135deg,#123e56 0,#123e56 18px,#17516e 18px,#17516e 36px); color: #fff; border-bottom: 3px solid #0b2b3d; box-shadow: 0 4px 16px rgba(8,34,49,.32); text-align: center; }
.is-production .sidebar { top: calc(52px + var(--safe-top)); height: calc(100vh - 52px - var(--safe-top)); }
.is-production .app-shell { padding-top: calc(52px + var(--safe-top)); }
.is-production .topbar { top: calc(52px + var(--safe-top)); }
.is-production .login-overlay { top: calc(52px + var(--safe-top)); }

@media (max-width: 1250px) {
  .top-actions .account-menu-button { display: grid; min-width: 44px; }
  .top-actions .account-menu-button small { display: none; }
}
@media (max-width: 820px) {
  .topbar { min-height: 64px; height: 64px; padding-block: 0; }
  .topbar > div:nth-child(2) { min-width: 0; }
  .topbar h1 { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .top-actions #companyFilter { display: none !important; }
  .topbar { position: fixed!important; left: 0; right: 0; z-index: 10; }
  .is-staging .topbar,.is-production .topbar { top: calc(var(--staging-content-height) + var(--safe-top)); }
  .is-staging .app-shell,.is-production .app-shell { box-sizing: border-box; padding-top: calc(var(--staging-content-height) + var(--safe-top) + 64px); }
  .topbar .top-actions>#mobileCompanySwitch.mobile-company-switch:not(.hidden) { position: relative!important; display: grid!important; grid-template-columns: 1fr auto; place-items: center; width: 48px; min-width: 48px; height: 44px; padding: 0 7px; overflow: hidden; border: 1px solid #cbd9e3; border-radius: 12px; background: #f7fafc; color: #173f55; box-shadow: none; cursor: pointer; }
  .mobile-company-switch select { position: absolute; inset: 0; display: block!important; width: 100%; max-width: none!important; height: 100%; min-height: 0; padding: 0; opacity: 0; cursor: pointer; }
  .mobile-company-switch:focus-within { border-color: #2f83c5; box-shadow: 0 0 0 3px rgba(47,131,197,.16); }
  main { padding-top: 18px; }
  .account-menu-dialog { margin: auto; }
  .top-actions .refresh-icon { display: none; }
  .recovery-codes-list,.recovery-code-tools { grid-template-columns: 1fr; }
  .recovery-codes-dialog .dialog-card { padding: 22px 18px max(22px,env(safe-area-inset-bottom,0px)); }
  .top-actions .account-menu-button { display: grid !important; grid-template-columns: 40px 14px; min-width: 62px; padding: 3px 7px; }
  .top-actions .account-summary { display: none; }
  .is-production .staging-banner { height: calc(62px + var(--safe-top)); flex-direction: column; gap: 2px; padding: calc(7px + var(--safe-top)) 12px 7px; line-height: 1.15; }
  .is-production .sidebar { top: calc(62px + var(--safe-top)); height: calc(100vh - 62px - var(--safe-top)); }
  .is-production .app-shell { padding-top: calc(62px + var(--safe-top) + 64px); }
  html.is-production .topbar { top: calc(62px + var(--safe-top)); height: 64px; min-height: 64px; padding-top: 0; }
  .is-production .login-overlay { top: calc(62px + var(--safe-top)); }
}
@media (max-width: 480px) {
  .top-actions .account-menu-button { grid-template-columns: 40px!important; width: 44px; min-width: 44px; padding: 2px!important; }
  .top-actions .account-chevron { display: none; }
}
