  *, *::before, *::after { box-sizing: border-box; }
  html, body { margin: 0; height: 100%; }

  /* ── Ingreso ──
     Una sola caja centrada sobre el azul de la marca. La versión anterior era
     una pantalla partida con calendario animado, cartera de ejemplo y un feed
     de eventos: material de venta puesto donde la gente entra a trabajar todos
     los días. Quien entra ya decidió; solo necesita su correo y su clave.

     El fondo azul es SOLO del login: si se deja global, pinta también la app y
     los títulos quedan ilegibles. */
  body.login-on {
    font-feature-settings: "tnum" 1, "ss01" 1;
    background:
      radial-gradient(900px 520px at 50% -8%, #1B4190 0%, transparent 65%),
      var(--ink-950);
  }

  #ingreso { display: none; }
  #ingreso.on { display: grid; place-items: center; min-height: 100vh; padding: 24px 16px;
    position: relative; isolation: isolate; }

  /* ── El fondo ──
     Tres capas, todas muy por debajo del umbral de «decoración». Lo que se
     busca es profundidad, no espectáculo: una caja blanca sobre un degradado
     plano se ve barata y, en pantallas reales, el degradado se escalona.

     1 · La rejilla de libro contable. No es un patrón cualquiera: es el papel
         sobre el que trabaja quien está por entrar.
     2 · Un barrido de luz que cruza cada 26 segundos. Se nota solo si uno se
         queda mirando, que es exactamente la intención.
     3 · Grano. Es lo que impide que el degradado se vea en bandas y lo que
         separa un fondo diseñado de un `background: linear-gradient`. */
  .fondo { position: fixed; inset: 0; pointer-events: none; z-index: -1; }

  .fondo::before,
  .fondo::after { content: ""; position: absolute; inset: 0; }

  /* 1 · rejilla, desvanecida hacia los bordes */
  .fondo {
    background-image:
      linear-gradient(to right, rgba(175, 193, 227, .07) 1px, transparent 1px),
      linear-gradient(to bottom, rgba(175, 193, 227, .07) 1px, transparent 1px);
    background-size: 34px 34px;
    -webkit-mask-image: radial-gradient(1150px 720px at 50% 44%, #000 12%, transparent 76%);
    mask-image: radial-gradient(1150px 720px at 50% 44%, #000 12%, transparent 76%);
  }

  /* 2 · barrido */
  .fondo::before {
    inset: -45%;
    background: linear-gradient(104deg,
      transparent 44%, rgba(255, 209, 0, .05) 50%, transparent 56%);
    animation: barrido 26s linear infinite;
  }
  @keyframes barrido {
    from { transform: translate3d(-26%, 0, 0); }
    to   { transform: translate3d(26%, 0, 0); }
  }

  /* 3 · grano */
  .fondo::after {
    opacity: .5; mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23g)' opacity='.22'/%3E%3C/svg%3E");
  }

  @media (prefers-reduced-motion: reduce) {
    .fondo::before { animation: none; }
  }

  .caja {
    width: min(400px, 100%);
    background: var(--surface);
    border-radius: var(--r-lg);
    box-shadow: 0 24px 60px rgba(5, 18, 45, .34);
    padding: 34px 32px 28px;
  }

  .logo {
    display: flex; align-items: center; gap: 10px;
    font-weight: 600; font-size: var(--fs-20); letter-spacing: -.01em;
    color: var(--heading); margin-bottom: 26px;
  }

  label { display: block; font-size: var(--fs-13); font-weight: 500; margin-bottom: 6px; color: var(--text); }
  .field { margin-bottom: 18px; }
  .field-row { display: flex; justify-content: space-between; align-items: baseline; }
  .field-row a { font-size: var(--fs-13); color: var(--accent); text-decoration: none; }
  .field-row a:hover { text-decoration: underline; }
  .input { position: relative; }
  input[type=email], input[type=password], input[type=text] {
    width: 100%; height: 42px; padding: 0 12px; font: inherit; font-size: var(--fs-14);
    border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text);
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
  }
  input::placeholder { color: var(--text-3); }
  input:hover { border-color: #B5BDC9; }
  input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
  .reveal { position: absolute; right: 6px; top: 6px; height: 30px; padding: 0 8px; border: 0; background: none;
    color: var(--text-3); font: inherit; font-size: var(--fs-12); border-radius: 4px; cursor: pointer; }
  .reveal:hover { color: var(--text); background: var(--surface-2); }

  .btn-primary {
    width: 100%; height: 44px; border: 0; border-radius: var(--r-sm); cursor: pointer; margin-top: 4px;
    background: var(--saffron); color: var(--text-on-yellow); font: inherit; font-size: var(--fs-14); font-weight: 600;
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    transition: background var(--t-fast), transform var(--t-fast); position: relative;
  }
  .btn-primary:hover { background: var(--saffron-hover); }
  .btn-primary:active { background: var(--saffron-press); transform: translateY(1px); }
  .btn-primary:focus-visible { outline: none; box-shadow: var(--focus); }
  .btn-primary .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
  .btn-primary.loading .dot { animation: blink 700ms infinite alternate; }
  @keyframes blink { to { opacity: .2; } }

  /* El error va bajo el campo que falló y, si es del servidor, bajo el botón. */
  .field.bad input { border-color: var(--risk); }
  .field .err { display: none; font-size: var(--fs-12); color: var(--risk); margin-top: 5px; }
  .field.bad .err { display: block; }
  .auth-msg { display: none; margin-top: 14px; font-size: var(--fs-13); color: var(--risk);
    background: var(--risk-bg); border: 1px solid var(--risk-line); border-radius: var(--r-sm); padding: 10px 12px; }
  .auth-msg.on { display: block; }
  .auth-msg.ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-line); }
