:root {
  --auth-ink: #111a36;
  --auth-muted: #6d7894;
  --auth-line: #dce4f6;
  --auth-blue: #315efb;
  --auth-violet: #6747e8;
}

body.auth-pending,
body.auth-required {
  overflow: hidden;
}

body.auth-pending .app-shell,
body.auth-required .app-shell {
  visibility: hidden;
}

body.auth-authenticated .auth-gate {
  display: none;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 32px 20px 62px;
  color: var(--auth-ink);
  background:
    radial-gradient(circle at 18% 18%, rgba(82, 132, 255, .18), transparent 32%),
    radial-gradient(circle at 82% 78%, rgba(112, 66, 232, .16), transparent 34%),
    linear-gradient(145deg, #f8fbff 0%, #f4f3ff 52%, #eef6ff 100%);
}

.auth-gate::before {
  content: "";
  position: fixed;
  inset: 0;
  opacity: .34;
  pointer-events: none;
  background-image: linear-gradient(rgba(69, 92, 160, .08) 1px, transparent 1px), linear-gradient(90deg, rgba(69, 92, 160, .08) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(to bottom, #000, transparent 88%);
}

.auth-ambient span {
  position: fixed;
  width: 280px;
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(4px);
  opacity: .42;
  pointer-events: none;
}

.auth-ambient span:nth-child(1) { left: -100px; top: 12%; background: radial-gradient(circle, rgba(53, 108, 255, .28), transparent 68%); }
.auth-ambient span:nth-child(2) { right: -70px; top: 6%; background: radial-gradient(circle, rgba(120, 74, 229, .22), transparent 68%); }
.auth-ambient span:nth-child(3) { right: 12%; bottom: -120px; background: radial-gradient(circle, rgba(41, 176, 163, .2), transparent 68%); }

.auth-card {
  position: relative;
  width: min(448px, 100%);
  padding: 34px 38px 28px;
  border: 1px solid rgba(255, 255, 255, .92);
  border-radius: 26px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 28px 70px rgba(51, 63, 117, .17), 0 3px 12px rgba(45, 61, 112, .08);
  backdrop-filter: blur(18px);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  padding-bottom: 26px;
  border-bottom: 1px solid #e9edf7;
}

.auth-brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 17px;
  box-shadow: 0 10px 25px rgba(49, 94, 251, .2);
}

.auth-brand strong,
.auth-brand small { display: block; }
.auth-brand strong { font-size: 21px; letter-spacing: -.02em; }
.auth-brand small { margin-top: 4px; color: var(--auth-muted); font-size: 12px; }

.auth-heading { padding: 29px 0 23px; }
.auth-heading > span { color: var(--auth-blue); font-size: 11px; font-weight: 800; letter-spacing: .2em; }
.auth-heading h1 { margin: 9px 0 9px; font-size: 30px; line-height: 1.18; letter-spacing: -.04em; }
.auth-heading p { margin: 0; color: var(--auth-muted); font-size: 14px; line-height: 1.7; }

.auth-form { display: grid; gap: 18px; }
.auth-form label > span:first-child { display: block; margin-bottom: 8px; color: #3e4964; font-size: 13px; font-weight: 700; }
.auth-form input {
  width: 100%;
  height: 49px;
  box-sizing: border-box;
  border: 1px solid var(--auth-line);
  border-radius: 13px;
  padding: 0 15px;
  outline: none;
  color: var(--auth-ink);
  background: #fbfcff;
  font: inherit;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.auth-form input:focus { border-color: #7795ff; background: #fff; box-shadow: 0 0 0 4px rgba(49, 94, 251, .11); }
.auth-password { position: relative; display: block; }
.auth-password input { padding-right: 49px; }
.auth-password button { position: absolute; right: 7px; top: 6px; display: grid; place-items: center; width: 37px; height: 37px; border: 0; border-radius: 10px; color: #7b86a2; background: transparent; cursor: pointer; }
.auth-password button:hover { color: var(--auth-blue); background: #edf2ff; }
.auth-password svg { width: 18px; height: 18px; }
.auth-error { margin: -5px 0 0; padding: 10px 12px; border: 1px solid #ffd3d8; border-radius: 10px; color: #ca3349; background: #fff3f5; font-size: 13px; }
.auth-submit { display: flex; align-items: center; justify-content: center; gap: 9px; height: 51px; margin-top: 2px; border: 0; border-radius: 14px; color: #fff; background: linear-gradient(135deg, var(--auth-blue), var(--auth-violet)); box-shadow: 0 12px 25px rgba(73, 75, 229, .24); font: inherit; font-weight: 750; cursor: pointer; transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease; }
.auth-submit:hover { transform: translateY(-1px); box-shadow: 0 15px 30px rgba(73, 75, 229, .3); }
.auth-submit:disabled { cursor: wait; opacity: .68; transform: none; }
.auth-submit svg { width: 18px; height: 18px; }
.auth-security { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 23px; color: #7d87a0; font-size: 11px; }
.auth-security svg { width: 15px; height: 15px; color: #24a58a; }
.auth-gate footer { position: fixed; bottom: 22px; color: #8791aa; font-size: 11px; letter-spacing: .04em; }

.identity-logout {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-left: 2px;
  border: 0;
  border-left: 1px solid #e6eaf4;
  color: #8a93aa;
  background: transparent;
  cursor: pointer;
}
.identity-logout:hover { color: #315efb; }
.identity-logout svg { width: 17px; height: 17px; }

.sidebar-footer .auth-logout-nav {
  margin-top: 7px;
  color: #69738c;
}
.sidebar-footer .auth-logout-nav:hover { color: #315efb; background: #eef2ff; }

@media (max-width: 560px) {
  .auth-gate { align-items: start; padding-top: 20px; }
  .auth-card { padding: 27px 23px 24px; border-radius: 22px; }
  .auth-heading { padding-top: 24px; }
  .auth-heading h1 { font-size: 27px; }
  .auth-gate footer { position: absolute; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-submit, .auth-form input { transition: none; }
}
