@if(session('message'))
{{ session('message') }}
@endif @if(session('error'))
{{ session('error') }}
@endif

{{ __('Email Accounts') }}

{{ $centralMailboxMode ? __('Your mailbox connection is managed centrally by FortyMail.') : __('Connect and manage your email accounts.') }}

@unless($centralMailboxMode) @endunless
@if($centralMailboxMode)

{{ __('Centrally managed mailbox') }}

{{ __('IMAP and SMTP hosts are set by the FortyMail administrator. If your mailbox password changes, sign out and sign back in with the new password to refresh the encrypted connection credentials.') }}

@endif {{-- Connected accounts --}} @forelse($accounts as $account)

{{ $account->email }}

@if($account->is_default) {{ __('Default') }} @endif

{{ $account->display_name ?? ucfirst($account->provider) }} · @if($account->isConnected()) {{ __('Connected') }} @else {{ ucfirst($account->status) }} @endif @if($account->last_synced_at) · {{ __('Last sync') }} {{ $account->last_synced_at->diffForHumans() }} @endif

@if($account->error_message)

{{ __('Connection issue') }}

@if(str_contains($account->error_message, 'OAuth') || str_contains($account->error_message, 'token')) {{ __('Your email account needs to be reconnected. Sign out and sign back in to refresh the mailbox connection.') }} @elseif(str_contains($account->error_message, 'IMAP') || str_contains($account->error_message, 'connection')) {{ __('We couldn\'t reach your email server. Please check your email settings and try again.') }} @else {{ __('Something went wrong with your email connection. Try reconnecting your account.') }} @endif

@endif
{{-- AI toggle --}} @unless($centralMailboxMode) {{-- Reconnect button (visible when disconnected/error) --}} @if(!$account->isConnected()) @if($account->isOAuth()) @else @endif @endif {{-- Edit button --}} {{-- More actions dropdown (teleported so rounded card / tab content can't clip the menu below the fold) --}}
@endunless
@empty @if($centralMailboxMode) @else @endif @endforelse {{-- Provider Picker Modal --}} @if(!$centralMailboxMode && $showProviderPicker) @endif {{-- Add/Edit Account Modal --}} @if(!$centralMailboxMode && $showAddForm) @endif