/* ============================================================================
   loginScreen.css — the violet sign-in screen (replaces loginLife.css).

   The approved mockup: a centred, card-less form on lilac porcelain, the
   Repark cube as a faint watermark behind it, a top bar with the mark and a
   footer hairline with the legal links. Same token set as containersV2.css /
   stockViolet.css; no blue anywhere.

   EVERYTHING IS SCOPED TO #loginBox. style.css, polish.css and dark.css all
   style bare button / input / .ghost / .login-* globally (several with
   :hover, one with !important on .login-shell). An id beats every class-only
   rule there, so nothing below needs !important except where noted. The old
   .login-shell / .login-card classes are no longer used by the markup, which
   is what takes polish.css's !important gradient out of play.
   ========================================================================== */
#loginBox{
  --lgn-aub:#1B1626; --lgn-aub2:#262033;
  --lgn-ground:#F6F5F8; --lgn-paper:#fff; --lgn-line:#E9E7EE; --lgn-line2:#DAD7E2;
  --lgn-ink:#1D1826; --lgn-mut:#5F5970; --lgn-faint:#948DA3;
  --lgn-acc:#5E48B8; --lgn-acc-deep:#49389A; --lgn-acc-wash:#EFECFA; --lgn-acc-line:#CFC7EC;
  --lgn-acc-shadow:rgba(94,72,184,.5);
  --lgn-ghost-line:#E7E4EE; --lgn-ghost-fill:#F0EDF6;
  --lgn-on-aub:#F2F0F6;
  --lgn-ok:#177550;
  --lgn-bad:#B42318; --lgn-bad-wash:#FBEDEA; --lgn-bad-line:#F0C5BE;
  --lgn-veil:rgba(27,22,38,.92);
  --lgn-gutter:42px;
  --lgn-display:'Bricolage Grotesque','Instrument Sans',system-ui,sans-serif;
  --lgn-ui:'Instrument Sans',system-ui,-apple-system,'Segoe UI',sans-serif;
}
html[data-theme="dark"] #loginBox{
  --lgn-aub:#0F0C16; --lgn-aub2:#2A2342;
  --lgn-ground:#15121C; --lgn-paper:#1E1A27; --lgn-line:#2E2839; --lgn-line2:#3A3349;
  --lgn-ink:#EEEAF6; --lgn-mut:#ABA4BC; --lgn-faint:#7E7792;
  --lgn-acc:#7C66D6; --lgn-acc-deep:#9C88F0; --lgn-acc-wash:#2A2342; --lgn-acc-line:#4A3F73;
  --lgn-acc-shadow:rgba(0,0,0,.5);
  --lgn-ghost-line:#241F30; --lgn-ghost-fill:#1A1622;
  --lgn-on-aub:#EEEAF6;
  --lgn-bad:#F07A6C; --lgn-bad-wash:#33191A; --lgn-bad-line:#5C2B28;
  --lgn-veil:rgba(10,8,15,.92);
}

/* The page. .hidden (style.css, !important) still hides it — that is how auth.js toggles it. */
#loginBox{
  position:fixed; inset:0; z-index:1000; overflow-y:auto;
  display:flex; flex-direction:column; min-height:100%;
  background:var(--lgn-ground); color:var(--lgn-ink);
  font:14px/1.5 var(--lgn-ui); -webkit-font-smoothing:antialiased;
}
#loginBox *{box-sizing:border-box}

/* ── top bar and footer share one gutter, so the mark and the © line start on the same edge */
#loginBox .lgn-bar{display:flex;align-items:center;gap:12px;padding:24px var(--lgn-gutter);position:relative;z-index:1}
#loginBox .lgn-tile{width:40px;height:40px;flex:none;border-radius:10px;background:var(--lgn-aub);display:grid;place-items:center;padding:6px}
#loginBox .lgn-tile img{width:100%;height:100%;display:block}
#loginBox .lgn-wd{display:flex;flex-direction:column;justify-content:center;gap:3px;line-height:1}
#loginBox .lgn-wd b{font-family:var(--lgn-display);font-weight:700;font-size:19px;letter-spacing:-.01em;color:var(--lgn-ink)}
#loginBox .lgn-wd small{font-weight:600;font-size:8.5px;letter-spacing:.32em;text-transform:uppercase;color:var(--lgn-faint)}

/* ── the form: dead centre between bar and footer. The watermark cube is centred on the same
   box, so the mark sits exactly behind the form at every height. */
/* overflow-x:clip — the cube is wider than a phone; clip (unlike hidden) cannot be scrolled sideways */
#loginBox .lgn-mid{flex:1;display:grid;place-items:center;position:relative;padding:24px;overflow-x:clip}
#loginBox .lgn-ghost{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:760px;height:760px;pointer-events:none}
#loginBox .lgn-ghost svg{width:100%;height:100%;display:block}
#loginBox .lgn-ghost path{fill:none;stroke:var(--lgn-ghost-line);stroke-width:1.1;stroke-linejoin:round}
#loginBox .lgn-ghost .lit{fill:var(--lgn-ghost-fill);stroke:none}
#loginBox .lgn-form{width:min(392px,100%);position:relative;display:flex;flex-direction:column}

#loginBox .lgn-head{text-align:center;display:flex;flex-direction:column;align-items:center;margin-bottom:28px}
#loginBox .lgn-kicker{display:inline-flex;align-items:center;gap:8px;font-size:10.5px;font-weight:700;line-height:1;letter-spacing:.14em;text-transform:uppercase;color:var(--lgn-acc)}
/* letter-spacing leaves a trailing gap after the last letter; pull it back so the rules sit evenly */
#loginBox .lgn-kicker span{margin-right:-.14em}
#loginBox .lgn-kicker::before,#loginBox .lgn-kicker::after{content:'';width:20px;height:2px;background:var(--lgn-acc-line)}
#loginBox .lgn-head h1{margin:12px 0 0;font-family:var(--lgn-display);font-weight:700;font-size:clamp(30px,3.4vw,38px);letter-spacing:-.02em;line-height:1.1;color:var(--lgn-ink);text-wrap:balance}
#loginBox .lgn-sub{margin:8px 0 0;color:var(--lgn-mut);font-size:14px}

/* ── controls. Every input and button here is restated from scratch: style.css gives bare
   input/button padding, margins, radius, weight 900 and a blue focus ring, and polish.css adds a
   lift + shadow on button:hover. */
#loginBox input:not([type=checkbox]){
  display:block;width:100%;min-width:0;height:46px;margin:0;
  font:inherit;font-size:14px;color:var(--lgn-ink);background:var(--lgn-paper);
  border:1.5px solid var(--lgn-line2);border-radius:10px;padding:0 13px;outline:none;box-shadow:none;
  transition:border-color .14s,box-shadow .14s;
}
#loginBox input::placeholder{color:var(--lgn-faint)}
#loginBox input:focus{border-color:var(--lgn-acc);box-shadow:0 0 0 3px var(--lgn-acc-wash)}
#loginBox input:-webkit-autofill,
#loginBox input:-webkit-autofill:hover,
#loginBox input:-webkit-autofill:focus{
  -webkit-text-fill-color:var(--lgn-ink);
  -webkit-box-shadow:0 0 0 40px var(--lgn-paper) inset;
  caret-color:var(--lgn-ink);
}
#loginBox label{display:block;font-size:12px;font-weight:600;color:var(--lgn-mut);margin:16px 0 6px}
#loginBox form > label:first-child{margin-top:0}

#loginBox button{
  display:flex;align-items:center;justify-content:center;gap:9px;width:100%;height:48px;margin:0;
  font:inherit;font-size:14px;font-weight:700;letter-spacing:normal;text-transform:none;
  color:#fff;background:var(--lgn-acc);border:1px solid var(--lgn-acc);border-radius:10px;padding:0 16px;
  box-shadow:0 8px 20px -10px var(--lgn-acc-shadow);transform:none;cursor:pointer;
  transition:background .15s;
}
#loginBox button:hover{background:var(--lgn-acc-deep);border-color:var(--lgn-acc-deep);transform:none;box-shadow:0 8px 20px -10px var(--lgn-acc-shadow)}
#loginBox button:active{transform:translateY(1px)}
#loginBox button:disabled{opacity:.7;cursor:progress}
#loginBox button:focus-visible,#loginBox a:focus-visible{outline:none;box-shadow:0 0 0 3px var(--lgn-acc-wash),0 0 0 4px var(--lgn-acc)}

/* the passkey button is the one structural (aubergine) action */
#loginBox #loginPasswordlessBtn{height:46px;font-size:13.5px;font-weight:600;color:var(--lgn-on-aub);background:var(--lgn-aub);border-color:var(--lgn-aub);box-shadow:none}
html[data-theme="dark"] #loginBox #loginPasswordlessBtn{border-color:var(--lgn-line2)}
#loginBox #loginPasswordlessBtn:hover{background:var(--lgn-aub2);border-color:var(--lgn-aub2)}
#loginBox #loginPasswordlessBtn svg{width:16px;height:16px;flex:none}
#loginBox .lgn-or{display:flex;align-items:center;gap:12px;color:var(--lgn-faint);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;margin:20px 0}
#loginBox .lgn-or::before,#loginBox .lgn-or::after{content:'';flex:1;height:1px;background:var(--lgn-line2)}

/* quiet secondary actions: Back, Try passkey again, Use a backup code */
#loginBox button.ghost{height:40px;margin-top:8px;font-size:13px;font-weight:600;color:var(--lgn-mut);background:transparent;border-color:transparent;box-shadow:none}
#loginBox button.ghost:hover{color:var(--lgn-ink);background:var(--lgn-acc-wash);border-color:transparent;box-shadow:none}

/* password reveal — sits inside the field's right end, never wider than the field */
#loginBox .lgn-pw{position:relative}
#loginBox .lgn-pw input{padding-right:46px}
#loginBox .lgn-pw .lgn-eye{
  position:absolute;right:7px;top:50%;transform:translateY(-50%);
  width:32px;height:32px;min-height:0;padding:0;margin:0;
  color:var(--lgn-faint);background:none;border:0;border-radius:7px;box-shadow:none;
  -webkit-appearance:none;appearance:none;-webkit-tap-highlight-color:transparent;
}
#loginBox .lgn-pw .lgn-eye:hover,
#loginBox .lgn-pw .lgn-eye:active{color:var(--lgn-mut);background:var(--lgn-acc-wash);transform:translateY(-50%);box-shadow:none}
#loginBox .lgn-pw .lgn-eye:focus-visible{transform:translateY(-50%)}
#loginBox .lgn-pw .lgn-eye svg{width:17px;height:17px;flex:none}

#loginBox .lgn-help{margin:12px 0 0;font-size:12.5px;color:var(--lgn-faint)}
#loginBox form > button[type=submit]{margin-top:22px}

/* ── the other steps (2FA, 2FA setup, device approval, expired password) */
#loginBox .lgn-step h2{margin:0;font-family:var(--lgn-display);font-weight:700;font-size:20px;letter-spacing:-.01em;color:var(--lgn-ink);text-align:center}
#loginBox .lgn-step > p:not(.error-text),#loginBox #loginTotpIntro{margin:6px 0 18px;font-size:13.5px;color:var(--lgn-mut);text-align:center}
#loginBox .lgn-step input + input,#loginBox .lgn-step input + button{margin-top:12px}
#loginBox .lgn-step > button:not(.ghost){margin-top:16px}
#loginBox #loginTotpCode,#loginBox #loginSetupTotpCode{text-align:center;font-size:20px;letter-spacing:.3em;font-variant-numeric:tabular-nums}
#loginBox #loginPasskeyBox{margin-bottom:8px}
#loginBox .qr-box{background:#fff;border:1px solid var(--lgn-line);border-radius:12px;margin:0 auto 16px;max-width:240px}

/* status lines: auth.js writes plain text into these */
#loginBox .error-text{margin:0;font-size:12.5px;font-weight:500;color:var(--lgn-bad)}
#loginBox .error-text:not(:empty){margin-top:8px}
#loginBox #loginMsg:not(:empty){
  margin:0 0 18px;padding:10px 13px;border-radius:10px;
  background:var(--lgn-bad-wash);border:1px solid var(--lgn-bad-line);color:var(--lgn-bad);
  font-size:13px;font-weight:500;text-align:center;
}

/* ── footer: one hairline, everything on it */
#loginBox .lgn-foot{margin:0;border-top:1px solid var(--lgn-line);padding:16px var(--lgn-gutter);display:flex;align-items:center;gap:22px;font-size:12px;line-height:1;color:var(--lgn-faint);position:relative;background:var(--lgn-ground)}
#loginBox .lgn-foot a{color:var(--lgn-faint);text-decoration:none;border-radius:4px}
#loginBox .lgn-foot a:hover{color:var(--lgn-mut);text-decoration:underline}

/* ── signing in: a veil over the form while a request is in flight. The mark inside is the
   shared RLoader component (rloader.css owns its motion); this sheet declares no .rload rule. */
#loginBox .lgn-signing{position:fixed;inset:0;z-index:5;display:none;place-items:center;background:var(--lgn-veil);-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px)}
#loginBox .lgn-signing.is-on{display:grid}
#loginBox .lgn-signing > div{display:flex;flex-direction:column;align-items:center;gap:6px}
#loginBox .lgn-loader-mark{width:100%;height:100%;display:block}
#loginBox .lgn-signing-msg{margin:0;font-size:14px;font-weight:600;color:var(--lgn-on-aub)}

/* ── dark.css answers with !important on every input and every .ghost button
   (dark.css:61-70 and :100-103), so in the dark theme these have to as well. */
html[data-theme="dark"] #loginBox input:not([type=checkbox]){background:var(--lgn-paper)!important;border-color:var(--lgn-line2)!important;color:var(--lgn-ink)!important}
html[data-theme="dark"] #loginBox input:focus{border-color:var(--lgn-acc)!important}
html[data-theme="dark"] #loginBox button.ghost{background:transparent!important;border-color:transparent!important;color:var(--lgn-mut)!important}
html[data-theme="dark"] #loginBox button.ghost:hover{background:var(--lgn-acc-wash)!important;color:var(--lgn-ink)!important}

@media (max-width:720px){
  #loginBox{--lgn-gutter:20px}
  #loginBox .lgn-ghost{width:520px;height:520px}
  #loginBox .lgn-foot{flex-wrap:wrap;gap:14px 18px}
}
@media (prefers-reduced-motion:reduce){
  #loginBox *{transition:none}
}
