<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Two-Factor Auth — {{ brand_name }}</title>
  <link rel="icon" type="image/png" href="/static/icon.png">
  <link rel="stylesheet" href="/static/style.css?v={{ sv }}">
  <style>
    body { display: flex; align-items: center; justify-content: center; min-height: 100vh; margin: 0; }
    .auth-card {
      background: var(--bg2);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 2.5rem 2rem;
      width: 100%;
      max-width: 360px;
    }
    .auth-logo { text-align: center; margin-bottom: 1.5rem; }
    .auth-logo img { height: 48px; width: 48px; object-fit: contain; }
    .auth-logo-name { font-size: 1.25rem; font-weight: 600; margin-top: 0.5rem; color: var(--text); }
    .auth-logo-sub { font-size: 0.75rem; color: var(--text-dim); margin-top: 0.15rem; }
    .auth-error {
      background: rgba(224,82,82,0.1);
      border: 1px solid rgba(224,82,82,0.3);
      color: var(--red);
      padding: 0.6rem 0.9rem;
      border-radius: var(--radius);
      font-size: 0.85rem;
      margin-bottom: 1rem;
    }
    .auth-field { margin-bottom: 1rem; }
    .auth-field label { display: block; font-size: 0.8rem; color: var(--text-dim); margin-bottom: 0.35rem; }
    .auth-field input {
      width: 100%;
      box-sizing: border-box;
      background: var(--bg3);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      color: var(--text);
      padding: 0.6rem 0.75rem;
      font-size: 1.2rem;
      letter-spacing: 0.2em;
      text-align: center;
      font-family: var(--font);
      outline: none;
      transition: border-color 0.15s;
    }
    .auth-field input:focus { border-color: var(--accent-dim); }
    .auth-btn {
      width: 100%;
      padding: 0.65rem;
      background: var(--accent);
      color: #fff;
      border: none;
      border-radius: var(--radius);
      font-size: 0.9rem;
      font-family: var(--font);
      font-weight: 600;
      cursor: pointer;
      margin-top: 0.5rem;
      transition: opacity 0.15s;
    }
    .auth-btn:hover { opacity: 0.88; }
    .auth-hint { font-size: 0.75rem; color: var(--text-dim); text-align: center; margin-top: 1.25rem; }
  </style>
</head>
<body>
  <div class="auth-card">
    <div class="auth-logo">
      <img src="{{ logo_url }}" alt="logo">
      <div class="auth-logo-name">{{ brand_name }}</div>
      <div class="auth-logo-sub">oAI-Web</div>
    </div>

    {% if error %}
    <div class="auth-error">{{ error }}</div>
    {% endif %}

    <form method="post" action="/login/mfa">
      <input type="hidden" name="next" value="{{ next }}">
      <div class="auth-field">
        <label for="code">Authenticator code</label>
        <input type="text" id="code" name="code"
               inputmode="numeric" maxlength="6" autocomplete="one-time-code"
               autofocus required placeholder="000000">
      </div>
      <button type="submit" class="auth-btn">Verify</button>
    </form>

    <p class="auth-hint">Lost your authenticator? Contact your administrator.</p>
  </div>
</body>
</html>
