<?php include __DIR__ . '/header.php'; ?>
<div class="page-wrap narrow">
  <div class="hero"><div><h2>Ingresar</h2><p>Accede a tu cuenta para ver tu dashboard.</p></div></div>
  <div class="card-tech">
    <?php if (!empty($authError)): ?>
      <div class="notice error" style="margin-bottom:14px"><?=htmlspecialchars($authError)?></div>
    <?php endif; ?>
    <form method="post" action="<?=htmlspecialchars($url('/login'))?>" class="stack">
      <?php $next = (string)($_GET['next'] ?? ''); ?>
      <?php if ($next !== ''): ?>
        <input type="hidden" name="next" value="<?=htmlspecialchars($next)?>">
      <?php endif; ?>
      <label class="field">Email
        <input type="email" name="email" required>
      </label>
      <label class="field">Contraseña
        <input type="password" name="password" required>
      </label>
      <button class="btn primary" type="submit" style="width:100%">Iniciar sesión</button>
    </form>
    <p class="muted" style="margin-top:12px">¿No tienes cuenta? <a href="<?=htmlspecialchars($url('/register'))?>">Regístrate</a></p>
  </div>
</div>
<?php include __DIR__ . '/footer.php'; ?>
