<section class="home">
  <h1 class="title" i18n="@@page.home.title">APF Portal Admin</h1>
  <p class="intro">
    Administrative back-office for the APF Portal. Sign in with an Entra account that carries the
    <code>admin</code> app role to reach the functional modules.
  </p>

  <article class="auth-card" aria-live="polite">
    @switch (state().kind) { @case ('loading') {
    <p class="status-line">Checking your admin session…</p>
    } @case ('anonymous') {
    <p class="status-line">No admin session detected.</p>
    <button type="button" class="btn btn--primary" (click)="signIn()">Sign in via Entra</button>
    } @case ('error') {
    <p class="status-line status-line--error">Could not reach the BFF to resolve the session.</p>
    <button type="button" class="btn btn--secondary" (click)="signIn()">Try sign in</button>
    } @case ('authenticated') { @if (currentUser(); as user) {
    <p class="status-line status-line--ok">Signed in as <strong>{{ user.displayName }}</strong>.</p>
    <dl class="session-detail">
      <dt>Username</dt>
      <dd>{{ user.username }}</dd>
      <dt>Tenant</dt>
      <dd>{{ user.tid }}</dd>
      <dt>OID</dt>
      <dd>{{ user.oid }}</dd>
    </dl>
    } } }
  </article>

  <section class="roadmap" aria-labelledby="roadmap-heading">
    <h2 id="roadmap-heading" class="roadmap-heading">Coming next</h2>
    <ul class="roadmap-list">
      <li>
        <strong>Audit log viewer</strong> — paginated, filterable view of <code>audit.events</code>.
      </li>
      <li><strong>CMS pages</strong> — CRUD on editorial content per locale (ADR-0019).</li>
      <li><strong>Menu management</strong> — toggle items + role-gate them.</li>
      <li><strong>User list</strong> — read-only directory derived from sign-in events.</li>
    </ul>
  </section>
</section>
