body.auth-locked .app-shell,
body.auth-locked .mobile-topbar,
body.auth-locked #projectModal {
  display: none !important;
}

body.auth-unlocked .auth-screen {
  display: none !important;
}

.sidebar-auth {
  flex: 0 0 auto;
  padding: 10px;
  border-top: 1px solid rgba(167, 190, 255, .1);
}

.auth-logout-btn {
  width: 100%;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 15px;
  color: rgba(238, 244, 255, .78);
  background: rgba(255, 255, 255, .04);
  font-family: var(--font-menu);
  font-size: 13px;
  font-weight: 600;
}

.auth-logout-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .07);
}

.auth-logout-btn:disabled {
  cursor: wait;
  opacity: .68;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  position: relative;
  z-index: 2;
  overflow: hidden;
  background:
    radial-gradient(circle at 13% 15%, rgba(54, 174, 239, .2), transparent 30%),
    radial-gradient(circle at 88% 84%, rgba(120, 101, 244, .14), transparent 32%),
    linear-gradient(145deg, #eff9fe, #f6f8fc 58%, #eef1f9);
}

.auth-screen::before,
.auth-screen::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(34px);
  pointer-events: none;
}

.auth-screen::before {
  top: -230px;
  left: -150px;
  background: rgba(71, 184, 238, .2);
}

.auth-screen::after {
  right: -180px;
  bottom: -250px;
  background: rgba(115, 100, 240, .13);
}

.auth-shell {
  width: min(100%, 960px);
  min-height: 590px;
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(390px, 1fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 32px;
  background: rgba(255, 255, 255, .42);
  box-shadow: 0 32px 90px rgba(62, 86, 117, .15), inset 0 1px 0 rgba(255, 255, 255, .92);
  backdrop-filter: blur(26px) saturate(130%);
  -webkit-backdrop-filter: blur(26px) saturate(130%);
  animation: authShellIn .5s cubic-bezier(.2, .8, .2, 1) both;
}

.auth-visual {
  min-width: 0;
  padding: 42px;
  display: flex;
  flex-direction: column;
  color: #f7fbff;
  background:
    radial-gradient(circle at 16% 12%, rgba(111, 217, 255, .32), transparent 29%),
    radial-gradient(circle at 90% 86%, rgba(145, 120, 255, .35), transparent 34%),
    linear-gradient(145deg, #187edb, #4268dc 56%, #725fd8);
}

.auth-visual-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
}

.auth-visual-brand > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 13px;
  background: rgba(255, 255, 255, .14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2);
  font-weight: 800;
}

.auth-visual-copy {
  margin: auto 0;
  padding: 46px 0;
}

.auth-visual-copy > span {
  display: block;
  margin-bottom: 13px;
  color: rgba(247, 251, 255, .72);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.auth-visual-copy h2 {
  max-width: 360px;
  margin: 0;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.04;
  letter-spacing: -.055em;
}

.auth-visual-copy p {
  max-width: 350px;
  margin: 22px 0 0;
  color: rgba(247, 251, 255, .76);
  font-size: 14px;
  line-height: 1.65;
}

.auth-visual-status {
  display: flex;
  align-items: center;
  gap: 9px;
  color: rgba(247, 251, 255, .78);
  font-size: 11px;
}

.auth-visual-status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #75f1c0;
  box-shadow: 0 0 0 5px rgba(117, 241, 192, .13);
}

.auth-card {
  position: relative;
  min-width: 0;
  padding: 54px 52px;
  display: grid;
  align-content: center;
  gap: 17px;
  color: #172033;
  background: rgba(251, 253, 255, .82);
  overflow: hidden;
  transition: background-color .42s ease, box-shadow .42s ease;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 4px;
}

.auth-brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-weight: 700;
  font-size: 13px;
}

.auth-brand p {
  margin: 0 0 2px;
  color: #7c8da1;
  font-family: var(--font-menu);
  font-size: 13px;
  font-weight: 600;
}

.auth-brand h1 {
  margin: 0;
  font-size: 27px;
  line-height: 1.15;
}

.auth-intro {
  margin: -3px 0 4px;
  color: #748497;
  font-size: 12px;
  line-height: 1.55;
}

.auth-field {
  display: grid;
  gap: 8px;
}

.auth-field span {
  color: #687a8f;
  font-size: 13px;
  font-weight: 600;
}

.auth-field input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid rgba(54, 77, 103, .14);
  border-radius: 14px;
  color: #172033;
  background: rgba(255, 255, 255, .78);
  outline: none;
}

.auth-field input:focus {
  border-color: #3f7ce9;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(63, 124, 233, .1);
}

.auth-field[hidden],
.auth-two-factor[hidden] {
  display: none;
}

.auth-two-factor {
  display: grid;
  gap: 14px;
  animation: authStepIn .26s cubic-bezier(.2, .8, .2, 1) both;
}

.auth-two-factor-copy {
  padding: 13px 14px;
  color: #6b7d91;
  background: rgba(233, 240, 249, .58);
  border: 1px solid rgba(75, 99, 128, .1);
  border-radius: 14px;
}

.auth-two-factor-copy strong,
.auth-two-factor-copy span {
  display: block;
}

.auth-two-factor-copy strong {
  color: #233044;
  font-size: 14px;
}

.auth-two-factor-copy span {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.5;
}

.auth-back {
  justify-self: start;
  padding: 0;
  color: #61748b;
  background: none;
  border: 0;
  font-size: 12px;
  font-weight: 600;
}

.auth-back:hover {
  color: #274f9e;
}

.auth-setup-key {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid rgba(61, 86, 118, .1);
  border-radius: 16px;
  background: rgba(255, 255, 255, .62);
}

.auth-setup-key img {
  width: 116px;
  height: 116px;
  padding: 5px;
  border-radius: 10px;
  background: #fff;
}

.auth-setup-key span,
.auth-device > small {
  display: block;
  color: #8291a2;
  font-size: 10px;
}

.auth-setup-key code {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  color: #34465c;
  font-size: 10px;
  letter-spacing: .04em;
}

.auth-expiry {
  color: #8291a2;
  font-size: 10px;
}

.auth-setup-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
}

.auth-device {
  justify-items: center;
  text-align: center;
}

.auth-device-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: rgba(55, 125, 228, .1);
}

.auth-device-icon > span {
  width: 22px;
  height: 30px;
  border: 2px solid #3978d9;
  border-radius: 5px;
  box-shadow: 0 0 0 5px rgba(57, 120, 217, .06);
}

.auth-device .auth-two-factor-copy {
  width: 100%;
}

.auth-recovery-codes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.auth-recovery-codes code {
  padding: 8px;
  border: 1px solid rgba(61, 86, 118, .1);
  border-radius: 9px;
  color: #34465c;
  background: rgba(255, 255, 255, .72);
  text-align: center;
  font-size: 10px;
}

.auth-success-state {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: #176a43;
  background: rgba(248, 255, 251, .98);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .22s ease, visibility 0s linear .22s;
}

.auth-success-check {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  color: #fff;
  background: #19a866;
  border-radius: 50%;
  box-shadow: 0 14px 34px rgba(25, 168, 102, .22);
  transform: scale(.86);
  transition: transform .24s cubic-bezier(.2, .8, .2, 1);
}

.auth-success-check svg {
  width: 38px;
  height: 38px;
  fill: none;
  stroke: currentColor;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-success-check path {
  stroke-dasharray: 36;
  stroke-dashoffset: 36;
  transition: stroke-dashoffset .42s cubic-bezier(.2, .8, .2, 1) .12s;
}

.auth-success-state strong {
  font-size: 16px;
}

.auth-card.is-success-transition {
  background: rgba(248, 255, 251, .96);
  box-shadow: inset 0 0 0 1px rgba(25, 168, 102, .12);
}

.auth-card.is-success-transition .auth-success-state {
  opacity: 1;
  visibility: visible;
  transition: opacity .22s ease;
}

.auth-card.is-success-transition .auth-success-check {
  transform: scale(1);
}

.auth-card.is-success-transition .auth-success-check path {
  stroke-dashoffset: 0;
}

.auth-error {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 107, 134, .28);
  border-radius: 14px;
  color: var(--danger);
  background: var(--danger-soft);
  font-size: 13px;
  font-weight: 600;
}

.auth-error[hidden] {
  display: none;
}

.auth-submit {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, #277de7, #685fe1);
  box-shadow: 0 13px 28px rgba(48, 102, 210, .19);
  font-weight: 700;
}

.auth-submit:disabled {
  cursor: wait;
  opacity: .72;
}

.auth-submit:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(48, 102, 210, .23);
}

@keyframes authShellIn {
  from { opacity: 0; transform: translateY(8px) scale(.992); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes authStepIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 820px) {
  .auth-shell {
    width: min(100%, 470px);
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .auth-visual {
    display: none;
  }
}

@media (max-width: 520px) {
  .auth-screen {
    padding: 12px;
  }

  .auth-shell {
    border-radius: 23px;
  }

  .auth-card {
    padding: 28px 22px;
  }

  .auth-setup-key {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-shell,
  .auth-two-factor,
  .auth-screen::before,
  .auth-screen::after {
    animation: none !important;
  }
}
