/* STEP479 — myLotDesk sign-in. Uses the modern day/night theme (data-ld227-theme),
   not the retired ld97 night lock. Two layouts: card and split.
   Scoped to #auth-gate so the rest of the app is untouched. Cinema and 445A
   leftovers in index.html are fully overridden here. */

#auth-gate.auth-gate{
  --ld479-bg:#04121e;
  --ld479-elev:#0b1b2c;
  --ld479-card:#071b2a;
  --ld479-text:#f4faff;
  --ld479-muted:#a6c3d5;
  --ld479-line:#28465b;
  --ld479-accent:#009fda;
  --ld479-cyan:#00d9f0;
  --ld479-button:#086fb4;
  --ld479-button-hover:#0c84d0;
  --ld479-input:#0a2234;
  --ld479-input-border:#2f5470;
  --ld479-shadow:0 8px 28px #0006;
  --ld479-error:#ff8b8b;
  --ld479-secure:#8ee0a8;
  --ld479-focus:#3dc4ff;
  box-sizing:border-box;
  position:fixed;
  inset:0;
  z-index:100;
  isolation:isolate;
  width:100%;
  height:100dvh;
  min-height:100vh;
  overflow:auto;
  padding:0;
  margin:0;
  gap:0;
  align-items:stretch;
  justify-items:stretch;
  color:var(--ld479-text);
  background:
    radial-gradient(ellipse at 0% 0%, #0c3b661a 0%, transparent 46%),
    radial-gradient(ellipse at 100% 100%, #009fda14 0%, transparent 42%),
    var(--ld479-bg);
  color-scheme:dark;
  font-family:Inter,'Segoe UI',Arial,sans-serif;
  -webkit-font-smoothing:antialiased;
}
#auth-gate.auth-gate[style*="display: flex"],
#auth-gate.auth-gate[style*="display:flex"]{
  display:grid !important;
  grid-template-columns:1fr;
  grid-template-rows:auto 1fr auto;
}
html[data-ld227-theme="day"] #auth-gate.auth-gate{
  --ld479-bg:#f1f5fa;
  --ld479-elev:#ffffff;
  --ld479-card:#ffffff;
  --ld479-text:#0b2036;
  --ld479-muted:#52657c;
  --ld479-line:#c5d6e8;
  --ld479-accent:#007eb8;
  --ld479-cyan:#009fda;
  --ld479-button:#086fb4;
  --ld479-button-hover:#0a7fc8;
  --ld479-input:#f7fafc;
  --ld479-input-border:#c5d6e8;
  --ld479-shadow:0 8px 28px #0b203614;
  --ld479-error:#b12e3c;
  --ld479-secure:#0b7a3a;
  --ld479-focus:#009fda;
  color-scheme:light;
  background:
    radial-gradient(ellipse at 0% 0%, #cfe8f8 0%, transparent 48%),
    radial-gradient(ellipse at 100% 100%, #d7eef9 0%, transparent 42%),
    var(--ld479-bg);
}
#auth-gate::before,
#auth-gate::after{display:none !important;content:none !important}

#auth-gate *,
#auth-gate *::before,
#auth-gate *::after{box-sizing:border-box}

/* Header — same language as the business-home bar, slightly tighter */
#auth-gate .ld479-top{
  grid-column:1 / -1;
  grid-row:1;
  display:flex;
  align-items:center;
  gap:16px;
  min-height:72px;
  padding:10px max(16px, env(safe-area-inset-left)) 10px max(16px, env(safe-area-inset-right));
  padding-left:max(16px, env(safe-area-inset-left));
  padding-right:max(18px, env(safe-area-inset-right));
  border-bottom:4px solid var(--ld479-cyan);
  background:var(--ld479-elev);
  color:var(--ld479-text);
}
#auth-gate .ld479-brand-lockup{
  display:flex;
  align-items:center;
  gap:18px;
  min-width:0;
}
#auth-gate .ld479-logo{
  display:block;
  width:clamp(148px, 22vw, 230px);
  height:56px;
  object-fit:contain;
  object-position:left center;
}
#auth-gate .ld479-logo-night{display:block}
#auth-gate .ld479-logo-day{display:none}
html[data-ld227-theme="day"] #auth-gate .ld479-logo-night{display:none}
html[data-ld227-theme="day"] #auth-gate .ld479-logo-day{display:block}
#auth-gate .ld479-caption{
  border-left:1px solid var(--ld479-line);
  padding-left:18px;
  color:var(--ld479-muted);
  font-size:clamp(10px, 1.1vw, 13px);
  font-weight:700;
  letter-spacing:.22em;
  text-transform:uppercase;
  white-space:nowrap;
}
#auth-gate .ld479-theme{
  margin-left:auto;
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:9px 13px;
  min-height:40px;
  background:transparent;
  border:1px solid var(--ld479-line);
  border-radius:7px;
  color:var(--ld479-text);
  line-height:1.2;
  font-family:inherit;
  font-size:13px;
  font-weight:600;
  letter-spacing:normal;
  text-transform:none;
  white-space:nowrap;
  cursor:pointer;
  box-shadow:none;
}
#auth-gate .ld479-theme svg{width:20px;height:20px;flex:none;display:block}
#auth-gate .ld479-theme:hover{border-color:var(--ld479-accent);color:var(--ld479-text)}
#auth-gate .ld479-theme:focus-visible,
#auth-gate button:focus-visible,
#auth-gate input:focus-visible{
  outline:2px solid var(--ld479-focus) !important;
  outline-offset:2px;
}

/* Shell */
#auth-gate .ld479-shell{
  grid-column:1 / -1;
  grid-row:2;
  display:grid;
  align-items:center;
  justify-items:center;
  gap:0;
  width:100%;
  min-height:0;
  padding:28px 20px 24px;
  padding-left:max(20px, env(safe-area-inset-left));
  padding-right:max(20px, env(safe-area-inset-right));
}

/* Brand panel (split only on desktop) */
#auth-gate .ld479-brand-panel{display:none}
#auth-gate .ld479-intro{text-align:center;margin:0 0 22px}
#auth-gate .ld479-intro h1,
#auth-gate .ld479-brand-panel h1{
  margin:0 0 8px;
  color:var(--ld479-text) !important;
  font-size:clamp(26px, 3vw, 42px);
  line-height:1.15;
  font-weight:800;
  letter-spacing:-.035em;
  text-transform:none;
}
#auth-gate .ld479-wordmark{font-style:italic;white-space:nowrap}
#auth-gate .ld479-wordmark span{color:var(--ld479-cyan)}
#auth-gate .ld479-intro p,
#auth-gate .ld479-brand-panel .ld479-lead{
  margin:0 !important;
  color:var(--ld479-muted) !important;
  font-size:15px !important;
  line-height:1.55;
  font-weight:500;
  text-transform:none;
  text-align:inherit;
}
#auth-gate .ld479-points{
  list-style:none;
  margin:28px 0 0;
  padding:0;
  display:grid;
  gap:10px;
}
#auth-gate .ld479-points li{
  display:flex;
  align-items:flex-start;
  gap:10px;
  color:var(--ld479-text);
  font-size:14px;
  line-height:1.45;
  font-weight:500;
}
#auth-gate .ld479-points li svg{
  width:18px;
  height:18px;
  flex:none;
  margin-top:2px;
  color:var(--ld479-cyan);
}
#auth-gate .ld479-secure{
  display:inline-flex;
  align-items:center;
  gap:7px;
  margin-top:28px;
  color:var(--ld479-secure);
  font-size:12px;
  font-weight:650;
  letter-spacing:.02em;
}
#auth-gate .ld479-secure svg{width:16px;height:16px}

/* Form card — IDs unchanged */
#auth-gate #login-form.auth-card,
#auth-gate #lotdesk-mfa-panel,
#auth-gate #lotdesk-pin-panel{
  position:relative;
  width:min(100%, 420px) !important;
  max-width:420px !important;
  margin:0 !important;
  padding:28px 28px 26px !important;
  background:var(--ld479-card) !important;
  color:var(--ld479-text) !important;
  border:1px solid var(--ld479-line) !important;
  border-top:6px solid var(--ld479-accent) !important;
  border-radius:12px !important;
  box-shadow:var(--ld479-shadow) !important;
}
#auth-gate #lotdesk-pin-panel{width:min(100%, 380px) !important;max-width:380px !important}
#auth-gate .auth-card h2,
#auth-gate #lotdesk-mfa-panel h2,
#auth-gate #lotdesk-pin-panel h2{
  margin:0 0 14px !important;
  color:var(--ld479-text) !important;
  font-size:18px !important;
  font-weight:750;
  letter-spacing:-.02em;
  text-transform:none !important;
  text-align:left;
}
#auth-gate #lotdesk-pin-panel h2{text-align:center}
#auth-gate .auth-card label,
#auth-gate #lotdesk-mfa-panel label{
  display:block;
  margin:14px 0 6px !important;
  color:var(--ld479-muted) !important;
  font-size:12px !important;
  font-weight:650;
  letter-spacing:.02em;
  text-transform:none !important;
}
#auth-gate .auth-card input,
#auth-gate #mfa-code,
#auth-gate #lotdesk-pin-input{
  display:block;
  width:100% !important;
  height:48px !important;
  min-height:48px !important;
  margin:0 !important;
  padding:10px 14px !important;
  background:var(--ld479-input) !important;
  color:var(--ld479-text) !important;
  border:1px solid var(--ld479-input-border) !important;
  border-radius:8px !important;
  box-shadow:none !important;
  font-family:inherit;
  font-size:16px !important;
  text-transform:none;
  color-scheme:inherit;
}
#auth-gate #mfa-code,
#auth-gate #lotdesk-pin-input{
  height:56px !important;
  min-height:56px !important;
  text-align:center;
  letter-spacing:.4em;
  font-size:22px !important;
  font-weight:650;
}
#auth-gate .auth-card input::placeholder,
#auth-gate #mfa-code::placeholder,
#auth-gate #lotdesk-pin-input::placeholder{
  color:var(--ld479-muted) !important;
  opacity:.85;
}
#auth-gate .auth-card input:focus,
#auth-gate #mfa-code:focus,
#auth-gate #lotdesk-pin-input:focus{
  outline:2px solid var(--ld479-focus) !important;
  outline-offset:1px;
  border-color:var(--ld479-accent) !important;
}
#auth-gate .ld445a-password,
#auth-gate .ld479-password{position:relative}
#auth-gate #login-password{padding-right:48px !important}
#auth-gate #ld445a-password-toggle{
  position:absolute;
  right:4px;
  top:50% !important;
  transform:translateY(-50%);
  width:40px;
  height:40px;
  min-height:0 !important;
  margin:0 !important;
  padding:0 !important;
  display:grid;
  place-items:center;
  background:transparent !important;
  border:0 !important;
  border-radius:6px;
  color:var(--ld479-muted) !important;
  box-shadow:none !important;
  cursor:pointer;
  line-height:1 !important;
}
#auth-gate #ld445a-password-toggle svg{width:20px;height:20px}
#auth-gate #ld445a-password-toggle[aria-pressed="true"]{
  background:transparent !important;
  color:var(--ld479-accent) !important;
}
#auth-gate button.primary,
#auth-gate #login-button,
#auth-gate #mfa-verify,
#auth-gate #lotdesk-pin-submit{
  width:100% !important;
  height:48px !important;
  min-height:48px !important;
  margin:20px 0 0 !important;
  padding:10px 16px !important;
  background:var(--ld479-button) !important;
  border:1px solid var(--ld479-button) !important;
  border-radius:8px !important;
  color:#fff !important;
  box-shadow:none !important;
  font-family:inherit;
  font-size:15px !important;
  font-weight:700;
  letter-spacing:normal;
  text-transform:none !important;
  cursor:pointer;
}
#auth-gate button.primary:hover,
#auth-gate #login-button:hover,
#auth-gate #mfa-verify:hover,
#auth-gate #lotdesk-pin-submit:hover{
  background:var(--ld479-button-hover) !important;
  border-color:var(--ld479-button-hover) !important;
}
#auth-gate button.primary:disabled{opacity:.7;cursor:wait}
#auth-gate #auth-error,
#auth-gate #mfa-error,
#auth-gate #lotdesk-pin-error{
  color:var(--ld479-error) !important;
  font-size:12px !important;
  line-height:1.5;
  margin:8px 0 0 !important;
  min-height:0;
  overflow-wrap:anywhere;
}
#auth-gate #auth-error:empty{display:none}
#auth-gate .auth-card .ld445a-help,
#auth-gate .auth-card .ld479-help{
  margin:14px 0 0 !important;
  color:var(--ld479-muted) !important;
  font-size:12px !important;
  line-height:1.5;
  text-align:center;
  text-transform:none !important;
}
#auth-gate #mfa-info,
#auth-gate #lotdesk-pin-panel p,
#auth-gate #lotdesk-mfa-panel p{
  color:var(--ld479-muted) !important;
  font-size:13px !important;
  line-height:1.5;
  text-transform:none !important;
}
#auth-gate #mfa-signout,
#auth-gate #lotdesk-pin-signout{
  display:block;
  margin:14px auto 0 !important;
  padding:6px 10px;
  background:transparent !important;
  border:0 !important;
  color:var(--ld479-muted) !important;
  cursor:pointer;
  font-family:inherit;
  font-size:13px;
  text-transform:none !important;
}
#auth-gate #mfa-signout:hover,
#auth-gate #lotdesk-pin-signout:hover{color:var(--ld479-text) !important}
#auth-gate .ld445a-pin-brand{display:none !important}

/* Phone QR: desktop only. Hidden on small screens — the visitor is already on a phone. */
#auth-gate .ld445a-phone,
#auth-gate .ld479-phone,
#auth-gate .ld479-brand-qr,
#auth-gate .ld445a-mfa-side,
#auth-gate #mfa-login-link{display:none}
#auth-gate .ld479-phone img,
#auth-gate .ld479-brand-qr img,
#auth-gate #mfa-login-link img,
#auth-gate #mfa-qr img{
  display:block;
  width:132px;
  height:132px;
  max-width:100%;
  margin:0 auto;
  padding:8px;
  object-fit:contain;
  background:#fff;
  border:1px solid var(--ld479-line);
  border-radius:10px;
  box-sizing:content-box;
}

/* Footer */
#auth-gate .ld479-foot,
#auth-gate .ld445a-auth-footer{
  grid-column:1 / -1;
  grid-row:3;
  padding:16px 20px max(18px, env(safe-area-inset-bottom));
  color:var(--ld479-muted);
  font-size:12px;
  line-height:1.6;
  text-align:center;
  text-transform:none !important;
}
#auth-gate .ld479-foot span{padding:0 6px;opacity:.7}

/* ===== Layout: Welcome Card (default compact) ===== */
html[data-ld479-layout="card"] #auth-gate .ld479-brand-panel{display:none}
html[data-ld479-layout="card"] #auth-gate .ld479-intro{display:block}

/* ===== Layout: Brand Split (desktop two-pane) ===== */
@media (min-width:900px){
  html[data-ld479-layout="split"] #auth-gate.auth-gate[style*="display: flex"],
  html[data-ld479-layout="split"] #auth-gate.auth-gate[style*="display:flex"]{
    grid-template-columns:minmax(0,1.05fr) minmax(0,1fr);
    grid-template-rows:auto 1fr auto;
  }
  html[data-ld479-layout="split"] #auth-gate .ld479-top,
  html[data-ld479-layout="split"] #auth-gate .ld479-foot,
  html[data-ld479-layout="split"] #auth-gate .ld445a-auth-footer{
    grid-column:1 / -1;
  }
  html[data-ld479-layout="split"] #auth-gate .ld479-shell{
    display:contents;
  }
  html[data-ld479-layout="split"] #auth-gate .ld479-brand-panel{
    display:flex;
    flex-direction:column;
    justify-content:center;
    align-items:flex-start;
    grid-column:1;
    grid-row:2;
    min-width:0;
    padding:48px clamp(32px, 5vw, 72px);
  }
  html[data-ld479-layout="split"] #auth-gate .ld479-intro{display:none}
  html[data-ld479-layout="split"] #auth-gate #login-form.auth-card,
  html[data-ld479-layout="split"] #auth-gate #lotdesk-mfa-panel,
  html[data-ld479-layout="split"] #auth-gate #lotdesk-pin-panel{
    grid-column:2;
    grid-row:2;
    justify-self:center;
    align-self:center;
    width:min(100% - 64px, 420px) !important;
  }
  html[data-ld479-layout="split"] #auth-gate .ld479-brand-qr{
    display:flex;
    align-items:center;
    gap:14px;
    margin-top:32px;
    padding-top:24px;
    border-top:1px solid var(--ld479-line);
    color:var(--ld479-muted);
    font-size:12px;
    line-height:1.45;
    text-align:left;
  }
  html[data-ld479-layout="split"] #auth-gate .ld479-brand-qr img{
    width:96px;
    height:96px;
    margin:0;
    flex:none;
  }
  /* MFA enrollment QR can stay visible in the panel if present */
  html[data-ld479-layout="split"] #auth-gate #mfa-qr{margin-top:12px}
}

/* Card layout: form + QR side by side on desktop so the card fits a laptop viewport */
@media (min-width:900px){
  html[data-ld479-layout="card"] #auth-gate #login-form.auth-card{
    width:min(100%, 720px) !important;
    max-width:720px !important;
    display:grid;
    grid-template-columns:minmax(0,1.2fr) minmax(0,0.9fr);
    column-gap:28px;
    align-items:stretch;
  }
  html[data-ld479-layout="card"] #auth-gate .ld479-intro{grid-column:1 / -1;margin-bottom:18px}
  html[data-ld479-layout="card"] #auth-gate .ld479-fields{min-width:0}
  html[data-ld479-layout="card"] #auth-gate .ld479-phone{
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:8px;
    margin:0;
    padding:0 0 0 24px;
    border-top:0;
    border-left:1px solid var(--ld479-line);
    text-align:center;
  }
  html[data-ld479-layout="card"] #auth-gate .ld479-phone h2{
    margin:0;
    font-size:14px;
    font-weight:700;
    color:var(--ld479-text);
    text-transform:none;
  }
  html[data-ld479-layout="card"] #auth-gate .ld479-phone p,
  html[data-ld479-layout="card"] #auth-gate .ld479-phone span{
    margin:0 !important;
    color:var(--ld479-muted) !important;
    font-size:12px !important;
    line-height:1.45;
  }
  html[data-ld479-layout="card"] #auth-gate .ld479-phone img{width:120px;height:120px}
}

/* Phone */
@media (max-width:699px){
  #auth-gate .ld479-top{min-height:60px;padding-top:8px;padding-bottom:8px;border-bottom-width:3px}
  #auth-gate .ld479-logo{width:150px;height:44px}
  #auth-gate .ld479-caption{display:none}
  #auth-gate .ld479-theme span{display:none}
  #auth-gate .ld479-theme{min-width:40px;padding:8px;justify-content:center}
  #auth-gate .ld479-shell{padding:18px 14px 16px;align-items:start}
  #auth-gate #login-form.auth-card,
  #auth-gate #lotdesk-mfa-panel,
  #auth-gate #lotdesk-pin-panel{
    padding:22px 18px 20px !important;
    width:100% !important;
    max-width:100% !important;
  }
  #auth-gate .ld479-intro{margin-bottom:16px}
  #auth-gate .ld479-intro h1{font-size:24px}
  #auth-gate .ld445a-phone,
  #auth-gate .ld479-phone,
  #auth-gate .ld479-brand-qr,
  #auth-gate #mfa-login-link{display:none !important}
}

@media (prefers-reduced-motion:reduce){
  #auth-gate *{transition:none !important}
}


/* Beat leftover cinema login rules in index.html (padding, dark background, uppercase). */
#auth-gate.auth-gate{
  padding:0 !important;
  margin:0 !important;
  border:0 !important;
  width:100% !important;
  height:100dvh !important;
  min-height:100vh !important;
  inset:0 !important;
  overflow:auto !important;
  background:
    radial-gradient(ellipse at 0% 0%, #0c3b661a 0%, transparent 46%),
    radial-gradient(ellipse at 100% 100%, #009fda14 0%, transparent 42%),
    var(--ld479-bg) !important;
  color:var(--ld479-text) !important;
  color-scheme:dark !important;
}
html[data-ld227-theme="day"] #auth-gate.auth-gate{
  background:
    radial-gradient(ellipse at 0% 0%, #cfe8f8 0%, transparent 48%),
    radial-gradient(ellipse at 100% 100%, #d7eef9 0%, transparent 42%),
    var(--ld479-bg) !important;
  color:var(--ld479-text) !important;
  color-scheme:light !important;
}
#auth-gate,
#auth-gate *:not(.ld479-caption){
  text-transform:none !important;
  letter-spacing:normal;
}
#auth-gate .ld479-caption{
  text-transform:uppercase !important;
  letter-spacing:.22em !important;
}
#auth-gate .ld479-intro h1,
#auth-gate .ld479-brand-panel h1{
  letter-spacing:-.035em !important;
}
#auth-gate .ld479-secure{
  letter-spacing:.02em !important;
}
#auth-gate .ld479-top{
  width:100% !important;
  margin:0 !important;
}
