<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Sign in &bull; <%= appName %></title>
  <link rel="icon" type="image/png" href="<%= asset('assets/img/favicon.png') %>">
  <link rel="stylesheet" href="<%= asset('assets/css/fonts.css') %>">
  <link rel="stylesheet" href="<%= asset('assets/css/tokens.css') %>">
  <link rel="stylesheet" href="<%= asset('assets/css/login.css') %>">
</head>
<body>

<div class="lp-root">
  <div class="lp-bg">
    <img src="<%= asset('assets/img/login-hero.jpeg') %>" alt="" aria-hidden="true">
    <div class="lp-bg-overlay"></div>
  </div>
  <div class="lp-blend" aria-hidden="true"></div>

  <div class="lp-layout">
    <div class="lp-card">
      <div class="lp-card-body">
        <div class="lp-brand">
          <div class="lp-logo-wrap"><img src="<%= asset('assets/img/logo-on-dark.png') %>" alt="The Union Group" class="lp-logo" width="190" height="124"></div>
          <h1 class="lp-brand-name"><%= appName %></h1>
        </div>

        <div class="lp-divider"></div>

        <% for (const f of flashes) { %>
          <% if ((f.type || '') === 'error') { %>
            <div class="lp-error" role="alert"><span><%= f.message %></span></div>
          <% } else { %>
            <div class="lp-note" role="status"><%= f.message %></div>
          <% } %>
        <% } %>

        <% if (error) { %>
          <div class="lp-error" role="alert">
            <svg class="lp-error-ico" width="15" height="15" viewBox="0 0 16 16" fill="none" aria-hidden="true">
              <circle cx="8" cy="8" r="7" stroke="#D4826A" stroke-width="1.2"/>
              <path d="M8 5v4M8 11v.5" stroke="#D4826A" stroke-width="1.2" stroke-linecap="round"/>
            </svg>
            <span><%= error %></span>
          </div>
        <% } %>

        <form method="POST" action="<%= url('login') %>" class="lp-form">
          <%- csrfField %>
          <% if (next !== null) { %><input type="hidden" name="next" value="<%= next %>"><% } %>

          <div>
            <label class="lp-label" for="username">Username or email</label>
            <input type="text" id="username" name="username" class="lp-input" required autofocus
                   autocomplete="username" autocapitalize="none" spellcheck="false" maxlength="100"
                   value="<%= usernameValue %>" placeholder="your.name or you@company.com">
          </div>

          <div>
            <label class="lp-label" for="password">Password</label>
            <input type="password" id="password" name="password" class="lp-input" required
                   autocomplete="current-password" maxlength="200" placeholder="&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;">
          </div>

          <button type="submit" class="lp-btn lp-btn-mt">Sign In</button>
        </form>

        <p class="lp-hint lp-hint-only">Forgot your password? <span>Ask your IT administrator for a new one.</span></p>
      </div>

      <div class="lp-footer">
        <p>&copy; <%= year %> The Union Group</p>
      </div>
    </div>
  </div>
</div>

</body>
</html>

