<?php $pageTitle = 'Platform Admin — Sign In'; require __DIR__ . '/../partials/standalone-head.php'; ?>

<div class="standalone-wrap">
  <div class="d-flex align-items-center gap-2 mb-4">
    <div class="brand-mark" style="background:#111827;">PA</div>
    <div class="fw-bold fs-5">Platform Admin</div>
  </div>

  <div class="standalone-card">
    <h2 class="mb-1">Sign in</h2>
    <p class="text-muted mb-4">This is the platform owner console — not a tenant login.</p>

    <?php $errors = \App\Core\Session::getFlash('_errors', []); ?>
    <?php if ($errors): ?>
      <div class="alert alert-danger">
        <ul class="mb-0">
          <?php foreach ($errors as $field => $messages): foreach ((array) $messages as $m): ?>
            <li><?= e($m) ?></li>
          <?php endforeach; endforeach; ?>
        </ul>
      </div>
    <?php endif; ?>

    <form method="POST" action="<?= base_url('platform/login') ?>">
      <?= csrf_field() ?>
      <div class="mb-3">
        <label class="form-label">Email</label>
        <input type="email" name="email" class="form-control" value="<?= old('email') ?>" required autofocus>
      </div>
      <div class="mb-4">
        <label class="form-label">Password</label>
        <input type="password" name="password" class="form-control" required>
      </div>
      <button type="submit" class="btn btn-dark w-100">Sign In</button>
    </form>
  </div>
</div>

</body>
</html>
