/* Inlogscherm van het dashboard (wachtwoord, 2FA-code, 2FA instellen).
   Vormgeving 1-op-1 van Masbay (masbay.netlify.app), een andere interne app
   van Masparts; de inlogtechniek blijft die van het dashboard. De pagina's
   komen uit src/dashboard/loginPages.js. Deze file staat vóór de auth-gate,
   net als tokens.css: alleen stijl, nooit data. */

/* Wat Masbay in zijn :root heeft en tokens.css niet. */
:root {
  --fw-normal: 400; --fw-medium: 500; --fw-semi: 600; --fw-bold: 700;
  --r-xl: var(--r-lg);
}

/* --- basis uit Masbay: alleen wat het inlogscherm gebruikt --- */
* { box-sizing: border-box; }
/* `hidden` moet altijd winnen van display: flex/grid hieronder. */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: var(--fs-base); line-height: 1.5;
  background: var(--ground); color: var(--ink);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { text-wrap: balance; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border: 1px solid var(--accent); border-radius: var(--r);
  font-family: var(--font); font-size: var(--fs-base); font-weight: var(--fw-semi); line-height: 1;
  background: var(--accent); color: var(--accent-ink); cursor: pointer; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(37,99,235,.3); text-decoration: none;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease), filter var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.btn:hover { filter: brightness(1.07); }
.btn:active:not(:disabled) { transform: scale(.985); }
.btn:disabled { opacity: .5; cursor: default; filter: none; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

input[type="text"], input[type="password"] {
  background: var(--panel); border: 1px solid var(--line-2); color: var(--ink);
  border-radius: var(--r); height: 36px; padding: 0 12px; font-size: var(--fs-base); font-family: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder { color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: var(--fs-base); color: var(--ink); font-weight: var(--fw-medium); }
.field input { width: 100%; height: 38px; font-size: var(--fs-base); }

.err { color: var(--crit); font-size: var(--fs-sm); min-height: 18px; }

/* ---------------------------------------------------------------- login -- */
/* Volledige pagina boven alles (ook de lightbox): links het merkvlak in de
   kleuren van het logo, rechts het formulier. Onder 900px valt het
   merkvlak weg en staat het formulier als kaart op de grijze ondergrond. */
.login {
  position: fixed; inset: 0; z-index: 300; background: var(--panel);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(440px, 42%);
}
.login-brand {
  position: relative; overflow: hidden; color: var(--on-ink);
  display: flex; flex-direction: column; padding: 40px 48px;
  background:
    radial-gradient(900px 520px at 100% 100%, color-mix(in oklab, var(--brand-red) 22%, transparent), transparent 62%),
    linear-gradient(160deg, var(--brand-navy) 0%, var(--brand-navy-2) 100%);
}
.login-brand > :not(.login-rotor) { position: relative; }
.login-brand-top { display: flex; align-items: center; gap: 12px; }
.login-badge {
  width: 40px; height: 40px; border-radius: var(--r-lg); background: var(--panel);
  display: grid; place-items: center; box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.login-badge img { width: 26px; height: 26px; display: block; }
.login-wordmark { font-size: var(--fs-lg); font-weight: var(--fw-bold); letter-spacing: -.01em; }
.login-brand-copy {
  max-width: 470px; margin-top: clamp(40px, 13vh, 140px);
  animation: login-rise 520ms var(--ease-out) 80ms both;
}
.login-eyebrow {
  margin: 0 0 14px; font-size: var(--fs-xs); font-weight: var(--fw-semi);
  letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.6);
}
.login-brand-copy h2 {
  margin: 0 0 28px; font-size: 38px; line-height: 1.12; font-weight: var(--fw-bold); letter-spacing: -.03em;
}
.login-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.login-points li { display: flex; align-items: center; gap: 12px; font-size: 15px; color: rgba(255,255,255,.85); }
.login-points svg {
  width: 24px; height: 24px; padding: 5px; flex: none; border-radius: 50%;
  background: rgba(255,255,255,.1); stroke: var(--on-ink); fill: none; stroke-width: 2.5;
  stroke-linecap: round; stroke-linejoin: round;
}
/* De remschijf rechtsonder, deels buiten beeld; de klauw zit linksboven op
   de schijf (zoals in het logo). De viewBox ligt om de schijf; de klauw
   steekt erbuiten (overflow: visible), tot 1,36 × de straal linksboven.
   Daarom begrenst --s ook op paneelbreedte (cqw) en op hoogte
   (104vh − 440px), zodat de klauw onder de opsomming blijft. */
.login-brand { container-type: inline-size; }
.login-rotor {
  --s: min(540px, 70vh, 58cqw, calc(104vh - 440px));
  position: absolute; width: var(--s); height: var(--s);
  right: calc(var(--s) * -.3); bottom: calc(var(--s) * -.3);
  overflow: visible; pointer-events: none;
}
/* Licht op het donkere vlak: de gleuven, pijlen en gaten tonen de
   achtergrond, zoals ze in het logo wit zijn. De doorzichtigheid staat op
   de hele groep, zodat schijf en aanvulling (overlap) één vlak blijven. */
.login-rotor-spin {
  fill: var(--on-ink); opacity: .09;
  transform-origin: 92.5px 92px; animation: login-spin 120s linear infinite;
}
.login-rotor .rr-caliper { fill: color-mix(in oklab, var(--brand-red) 72%, var(--brand-navy-2)); }
.login-rotor .rr-piston { fill: rgba(255,255,255,.75); }

/* --- het formulier --- */
.login-main {
  display: flex; flex-direction: column; align-items: center;
  padding: 40px 24px 24px; overflow-y: auto; min-height: 0;
}
.login-card { width: 100%; max-width: 380px; margin: auto 0; animation: login-rise 420ms var(--ease-out) both; }
.login-card.shake { animation: login-shake 380ms var(--ease); }
.login-logo { display: block; height: 42px; width: auto; margin: 0 0 36px; }
.login-card h1 { margin: 0 0 6px; font-size: 28px; line-height: 1.2; font-weight: var(--fw-bold); letter-spacing: -.025em; }
.login-sub { margin: 0 0 28px; color: var(--muted); font-size: var(--fs-base); }
.login .field { margin-bottom: 18px; }
.login-input { position: relative; }
.login-input > svg {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round; pointer-events: none;
  transition: stroke var(--t-fast) var(--ease);
}
.login-input:focus-within > svg { stroke: var(--accent); }
/* 16px: kleiner laat iOS bij het aantikken inzoomen. */
.login .login-input input { height: 44px; padding-left: 40px; font-size: var(--fs-md); }
.login .login-input #login-pass { padding-right: 46px; }
.login-eye {
  appearance: none; position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: var(--r-sm); background: transparent; color: var(--muted); cursor: pointer;
}
.login-eye:hover { background: var(--panel-2); color: var(--ink); }
.login-eye svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.login-eye .eye-shut, .login-eye[aria-pressed="true"] .eye-open { display: none; }
.login-eye[aria-pressed="true"] .eye-shut { display: block; }
.login-caps { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--warn); }
.login-caps svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.login-err {
  display: flex; align-items: flex-start; gap: 10px; min-height: 0; margin: 0 0 16px;
  padding: 10px 12px; border: 1px solid var(--crit-line); border-radius: var(--r);
  background: var(--crit-soft); color: var(--crit-text); line-height: 1.45;
}
.login-err::before {
  content: "!"; flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%;
  display: grid; place-items: center; background: var(--crit); color: var(--on-ink);
  font-size: var(--fs-2xs); font-weight: var(--fw-bold);
}
.login-err:empty { display: none; }

/* Bezig = de knop staat disabled (dat doet het script al): dan een
   draaiertje en "Signing in…" in plaats van "Sign in". */
.login-submit { width: 100%; height: 44px; margin-top: 4px; font-size: var(--fs-md); gap: 8px; }
.login-submit .when-busy, .login-submit .login-spin { display: none; }
.login-submit:disabled { opacity: .85; cursor: progress; }
.login-submit:disabled .when-idle { display: none; }
.login-submit:disabled .when-busy { display: inline; }
.login-submit:disabled .login-spin { display: inline-block; }
.login-spin {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35); border-top-color: var(--accent-ink);
  animation: login-spin 700ms linear infinite;
}

.login-help {
  margin: 28px 0 0; padding-top: 20px; border-top: 1px solid var(--line);
  font-size: var(--fs-sm); color: var(--muted);
}
.login-legal { margin: 24px 0 0; font-size: var(--fs-xs); color: var(--muted); }

@keyframes login-spin { to { transform: rotate(360deg); } }
@keyframes login-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes login-shake {
  0%, 100% { transform: none; }
  20% { transform: translateX(-7px); } 40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); } 80% { transform: translateX(2px); }
}

@media (max-width: 900px) {
  .login { grid-template-columns: minmax(0, 1fr); background: var(--ground); }
  .login-brand { display: none; }
  .login-main { padding: 24px 16px 20px; }
  .login-card {
    max-width: 420px; padding: 32px 24px 28px; background: var(--panel);
    border-radius: var(--r-xl); box-shadow: var(--shadow);
  }
  .login-logo { margin-bottom: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .login-card, .login-card.shake, .login-brand-copy, .login-rotor-spin { animation: none; }
}


/* --- alleen het dashboard: tweede stap (code) en 2FA instellen --- */
/* De code uit de authenticator-app: cijfers op vaste breedte, iets uit elkaar. */
.login .login-input .login-code { letter-spacing: .3em; font-variant-numeric: tabular-nums; }
.login-steps { margin: 0 0 20px 18px; padding: 0; color: var(--ink-2); }
.login-steps li { margin-bottom: 4px; }
.login-qr {
  display: block; width: 180px; height: 180px; margin: 0 auto 12px;
  border-radius: var(--r); box-shadow: 0 0 0 1px rgba(9,9,11,.08);
}
.login-key {
  margin: 0 0 20px; padding: 10px 12px; border-radius: var(--r); background: var(--panel-2);
  font-family: var(--mono); font-size: var(--fs-sm); letter-spacing: .06em; text-align: center; word-break: break-all;
}
